Algorithm_ZRF @ 2023-07-30 11:28:33
代码
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
int x, y, cnt;
priority_queue<int, vector<int>, greater<int>> s;
inline void shu_ru() {
cin >> x >> y;
}
inline void ji_suan() {
for (int i = x; i <= y; ++i) {
if (i % 4 == 0) {
if (i % 100 == 0) {
if (i % 400 == 0) {
cnt++;
s.push(i);
continue;
}
}
cnt++;
s.push(i);
}
}
}
inline void run_the_code() {
shu_ru();
ji_suan();
int b =s.size();
cout << cnt << endl;
for(int i = 1;i <= b;++i){
cout << s.top() << ' ';
s.pop();
}
}
int main() {
run_the_code();
return 0;
}
by Algorithm_ZRF @ 2023-07-30 11:34:48
已经找到错了,谢谢