1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include<iostream> using namespace std; int main(){ int kaishi,jieshu,i,m=0; cin>>kaishi>>jieshu; for(i=kaishi;i<=jieshu;i++){ if((i%4==0&&i%100!=0)||(i%400==0&&i%100==0)){ m++; } } cout<<m<<endl; for(i=kaishi;i<=jieshu;i++){ if((i%4==0&&i%100!=0)||(i%400==0&&i%100==0)){ cout<<i<<" "; } } return 0; }
|