Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
113880 | 罗子童 | 闰年的数量 | C++ | Compile Error | 0 MS | 0 KB | 511 | 2025-03-16 19:30:26 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; bool ru(int a){ if(a%4==0&&a%100!=0||a%400==0){ return 1; } else return 0; } int main(){ int x,f,s=0; cin>>x>>y; for(int i=x;i<=y;i++){ if(ru(i)) s++; } cout<<s; return 0; }
Main.cc: In function 'bool ru(int)': Main.cc:8:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(a%4==0&&a%100!=0||a%400==0){ ^ Main.cc: In function 'int main()': Main.cc:18:13: error: 'y' was not declared in this scope cin>>x>>y; ^ Main.cc:17:11: warning: unused variable 'f' [-Wunused-variable] int x,f,s=0; ^