求助qwq
查看原帖
求助qwq
1347770
UnfortunatelyDead楼主2024/5/1 07:23
void solve() {
	int a[] = {13, 1, 2, 3, 5, 4, 4, 2, 2, 2};
	auto checkmonth = [&](int x, int y) -> int {
		if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) return 31;
		if (y != 2) return 30;
		if (x % 4 == 0) return 29;
		return 28;
	}; int ans = 0;
	for (int i = 20000101; i <= 20240413; ++i) {
		int year = i / 10000;
		if (checkmonth(year, i / 100 % 100) < i % 100) {
			i = (i / 100 + 1) * 100 + 1;
		} if (i / 100 % 100 == 13) i = (year + 1) * 10000 + 101;
		int j = i, cnt = 0;
		while (j) {
			cnt += a[j % 10];
			j /= 10;
		} ans += cnt > 50;
	} write(ans, '\n');
}
2024/5/1 07:23
加载中...