提交时间:2024-02-27 23:12:58
运行 ID: 42476
#include<iostream> using namespace std; int runnian(int n) { if(n%4==0&&!n%100==0) return 0; else if(n%400==0) return 0; else return 1; } int main() { int x,y; cin>>x>>y; int s=0; for(int i=x;i<=y;i++){ if(runnian(i)==0) { s++; } } cout<<s<<endl; for(int i=x;i<=y;i++){ if(runnian(i)==0) { cout<<i<<" "; } } return 0; }