emmm....

蒙自市凤凰小学又阝十尃亻二  •  1年前


include <bits/stdc++.h>

using namespace std; int lucky[114514]; //m,fjdjesehghffhfghdghdjf"'z'''''''''''''''''' int main() {

int year, day = 43, ans = 0, x = 2;
cin >> year;
for (int i = 2004; i <= year; i++) {
	if (i % 100 == 0) {
		if (i % 400 == 0) {
			day += 31 * 6 + 30 * 3 + 29 + 18;
			if (day % 7 == 3) {
				lucky[ans] = i;
				ans++;
			}
			day += 43;
		} else {
			day +=  31 * 6 + 30 * 3 + 28 + 18;
			if (day % 7 == 3) {
				lucky[ans] = i;
				ans++;
			}
			day += 43;
		}
	} else {
		if (i % 4 == 0) {
			day +=  31 * 6 + 30 * 3 + 29 + 18;
			if (day % 7 == 3) {
				lucky[ans] = i;
				ans++;
			}
			day += 43;
		} else {
			day += 31 * 6 + 30 * 3 + 28 + 18;
			if (day % 7 == 3) {
				lucky[ans] = i;
				ans++;
			}
			day += 43;
		}
	}
	//cout << day << endl;
}
cout << ans << endl;
for (int i = 0; i < ans; i++) {
	cout << lucky[i] << " ";
}
return 0;

}


评论:


宋晨瑞  •  1年前

请先登录,才能进行评论