Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
83952 石依灵 闰年的数量 C++ Compile Error 0 MS 0 KB 278 2024-07-15 10:35:57

Tests(0/0):


Code:

#include<iostream> using namespace std; bool s(int year){ if(year%4==0&&year%100!=0||year%400==0){ return true; } else{ return false; } int main(){ int x,y,c=0; cin >> x >> y; for(int i=x;i<=y;i++){ if(s(i)) c++; } cout<<c; return 0; }


Run Info:

Main.cc: In function 'bool s(int)':
Main.cc:4:13: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
 if(year%4==0&&year%100!=0||year%400==0){ 
             ^
Main.cc:10:11: error: a function-definition is not allowed here before '{' token
 int main(){ 
           ^
Main.cc:19:1: error: expected '}' at end of input
 }
 ^