#25726: 不懂哪裡錯了


kalapon (YiHan)

學校 : 國立臺南女子高級中學
編號 : 140586
來源 : [36.238.192.98]
最後登入時間 :
2024-03-30 21:04:00

#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.244.66]
最後登入時間 :
2025-01-05 16:41:04

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

    cout<<"Yes"<<endl;

}

M不會 > e 又 == e

 

把&&改成||

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