Files
python/TangDou/Mkx/2023-08-20-7.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
675 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
const int N = 21;
int b[N];
int main() {
int start = 0;
for (int i = 1; i <= 20; i++) { // 按的20次
for (int j = start; j < start + i; j++) { // 举栗子: 10开始按3个10,11,12
b[j % 20 + 1]++; // 记录被按下的次数
cout << j % 20 + 1 << " "; // 输出本次被接下的房间号
}
cout << endl;
start = (start + i) % 20;
}
int cnt = 0;
for (int i = 1; i <= 20; i++)
if (b[i] % 2 == 0) cnt++;
cout << "Last On Count:" << cnt << endl;
return 0;
}