@[jifeng85](/user/408589) 测下样例ok?
by 159号程序员 @ 2020-10-20 18:57:50
你这个arr数组需要定义成全局的啊,要不然不会给你设初始值的
by 159号程序员 @ 2020-10-20 18:58:40
本地过了可能是编译器问题
by 159号程序员 @ 2020-10-20 18:58:55
arr没memset
by 江南才子一枚 @ 2020-10-20 19:19:08
@[159号程序员](/user/334586)
感谢 了解了
by jifeng85 @ 2020-10-21 09:57:03
@[159号程序员](/user/334586)
太感谢了
已经通过了
by jifeng85 @ 2020-10-21 09:59:46
```cpp
#include <iostream>
using namespace std;
int a, b, cnt = 0;
int leap[1500];
bool isLeap(int y) {
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
}
int main() {
cin >> a >> b;
for (int i = a; i <= b; ++i)
if (isLeap(i)) leap[cnt++] = i;
cout << cnt << endl;
for (int i = 0; i < cnt; ++i)
cout << leap[i] << " ";
return 0;
}
```
by Tianxn @ 2021-01-09 16:10:40