You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
675 B

2 years ago
#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;
}