| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148223 | 徐启航 | 18岁生日 | C++ | Compile Error | 0 MS | 0 KB | 924 | 2026-02-10 08:34:45 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<ctime> #include<cstdlib> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int run(int year){ if((year%4==0&&year%100!=0)||(year%400==0){ return 366; }return 365; }int main(){ int T; int year; int month; int day; int sum=0; scanf("%d",&T); for(int i=0;i<T;i++){ scanf("%d-%d-%d",&year,&month,&day); if(month==2&&day==29&&(run(year+18)==365)){ printf("%d\n",-1); }else{ if(((run(year)==366)&&(month<=2))||(((18+year)%4==0)&&(month>=3))){ sum+=366; }else{ sum+=365; } }printf("%d\n",sum); sum=0; } return 0; }
Main.cc: In function 'int run(int)':
Main.cc:9:47: error: expected ')' before '{' token
if((year%4==0&&year%100!=0)||(year%400==0){
^
Main.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
}int main(){
^
Main.cc: In function 'int main()':
Main.cc:18:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&T);
^
Main.cc:20:44: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d-%d-%d",&year,&month,&day);
^