#include<stdio.h> #include<string> using namespace std; int main(){ char s[5]; int a; while(scanf("%d%*c",&a)!=EOF){ gets(s); if((((s[2]-'0')-(s[0]-'0'))*60+((s[3]-'0')-(s[1]-'0')))>=(s[4]-'0')) puts("Yes"); else{ printf("%s\n","No"); } } return 0; }
結果CE
#0: 100% CE ()
/7843647/code_7843647.cpp: In function ‘int main()’: /7843647/code_7843647.cpp:9:3: error: ‘gets’ was not declared in this scope gets(s); ^~~~ /7843647/code_7843647.cpp:9:3: note: suggested alternative: ‘fgets’ gets(s); ^~~~ fgets
#0: 100% CE ()
/7843647/code_7843647.cpp: In function ‘int main()’: /7843647/code_7843647.cpp:9:3: error: ‘gets’ was not declared in this scope gets(s); ^~~~ /7843647/code_7843647.cpp:9:3: note: suggested alternative: ‘fgets’ gets(s); ^~~~ fgets
你或許可以先自己debug 你這根本執行不了
#include #include using namespace std; int main(){ char s[5]; int a; while(scanf("%d%*c",&a)!=EOF){ gets(s); if((((s[2]-'0')-(s[0]-'0'))*60+((s[3]-'0')-(s[1]-'0')))>=(s[4]-'0')) puts("Yes"); else{ printf("%s\n","No"); } } return 0; }
結果CE
scanf("%d%*c",&a)!=EOF 這邊出問題 %*c ??