Files
python/TangDou/Mkx/2023-08-20-7.cpp

25 lines
675 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}