#25726: 不懂哪裡錯了


kalapon (YiHan)

學校 : 國立臺南女子高級中學
編號 : 140586
來源 : [36.238.192.98]
最後登入時間 :
2024-03-30 21:04:00
b572. 忘了東西的傑克 -- 板橋高中練習題 | From: [36.237.189.139] | 發表日期 : 2021-06-17 14:55

#include<iostream>

using namespace std;

 

int main(){

int n;

int a,b,c,d,e;

int total1,total2;

cin>>n;

for(int i=1;i<n+1;i++){

cin>>a,b,c,d,e;

int M;

total1=a*60+b;

total2=c*60+d;

M=total2-total1;

if(M>e&&M==e){

cout<<"Yes"<<endl;

}

else{

cout<<"No"<<endl;

}

 

}

return 0;

}

 
#25730: Re:不懂哪裡錯了


jam930725@gmail.com (浮沉沉沉沉沉沉沉沉)

學校 : 國立臺中科技大學
編號 : 124762
來源 : [123.240.115.224]
最後登入時間 :
2022-08-27 13:56:53
b572. 忘了東西的傑克 -- 板橋高中練習題 | From: [123.110.34.107] | 發表日期 : 2021-06-17 17:04

if(M>e&&M==e){

    cout<<"Yes"<<endl;

}

M不會 > e 又 == e

 

把&&改成||

或是改成 M >= e 就可以了

 

 
ZeroJudge Forum