| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 137638 | hjx211132 | 18岁生日 | C++ | Compile Error | 0 MS | 0 KB | 948 | 2025-11-21 19:45:33 |
#include <bits/stdc++.h> using namespace std; int main() { int c,d,i,j,k,t,temp,b[12]={31,28,31,30,31,30,31,31,30,31,30,31}; string a; cin>>t; getline(cin,a); while (t--) { s=0; getline(cin,a); i=(a[0]-'0')*1000+(a[1]-'0')*100+(a[2]-'0')*10+(a[3]-'0'); j=(a[5]-'0')*10+a[6]-'0'; k=(a[8]-'0')*10+a[9]-'0'; c=j; d=k; if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) b[1]=29; else b[1]=28; j=j-1; s=s+b[j]-k+1; while (j+1<12) { s=s+b[j+1]; j++; } n=1; i=i+1; while (n<=18) { if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) { temp=1; b[1]=29; } else { temp=0; b[1]=28; } j=0; while (j<12) { s=s+b[j]; j++; } i++; n++; } if (temp!=0) { if (c==2 and d==b[1]) cout<<s<<endl;; else if (c==2 and d!=b[1]) cout<<-1<<endl;; } } }
Main.cc: In function 'int main()':
Main.cc:11:3: error: 's' was not declared in this scope
s=0;
^
Main.cc:18:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (i%400==0 and i%100==0 or i%4==0 and i%100!=0)
^
Main.cc:29:3: error: 'n' was not declared in this scope
n=1;
^
Main.cc:33:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (i%400==0 and i%100==0 or i%4==0 and i%100!=0)
^
Main.cc:56:5: error: expected '}' before 'else'
else if (c==2 and d!=b[1])
^
Main.cc: At global scope:
Main.cc:60:1: error: expected declaration before '}' token
}
^