P5737 【深基7.例3】闰年展示
作者:互联网
#include <bits/stdc++.h>
using namespace std;
//是不是闰年
bool isRunYear(int y) {
if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) return true;
return false;
}
const int N = 2010;
int a[N];
int idx;
int main() {
int x, y;
cin >> x >> y;
for (int i = x; i <= y; i++)if (isRunYear(i)) a[idx++] = i;
cout << idx << endl;
for (int i = 0; i < idx; i++) cout << a[i] << " ";
return 0;
}
标签:P5737,false,isRunYear,闰年,int,深基,传送门,return 来源: https://www.cnblogs.com/littlehb/p/15575540.html