NMS1L1 @ 2021-10-01 18:32:29
#include<bits/stdc++.h>
using namespace std;
bool isleap(int &year) {
if ((year % 4 == 0 && year % 100 != 0) || year % 400)
return true;
return false;
}
int main() {
vector<int> v;
bool FLAG = false;
int x, y, count = 0;
cin >> x >> y;
while (x != y) {
if(isleap(x)) {
++count;
v.push_back(x);
}
x+=4;
}
cout << count <<endl;
for (auto i :v) {
if (FLAG)
cout << " ";
cout << i;
FLAG= true;
}
}
by LroseC @ 2021-10-01 18:36:27
如果输入数据是
4 5
你的代码就会无限循环下去
by LroseC @ 2021-10-01 18:37:06
只要输入的
by ajahjahah @ 2021-10-01 19:00:26
用户名不和谐???
by tmp_get_zip_diff @ 2022-01-11 22:12:02
x+=4;
x++;