#本地可以过, 在线MLE
查看原帖
#本地可以过, 在线MLE
446566
NMS1L1楼主2021/10/1 18:32
#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;
    }
}
2021/10/1 18:32
加载中...