This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#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;