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.

33 lines
535 B

#include <bits/stdc++.h>
using namespace std;
int n;
const int INF = 0x3f3f3f3f;
/*
手推4
0 0 0 0
1 1 1 0
0 0 1 1
0 1 0 0
1 1 1 1
共4步
手推5
0 0 0 0 0
1 1 1 0 0
0 0 1 1 0
1 1 1 1 1
共3步
*/
void solve(int n) {
if (n % 3 == 0)
cout << n / 3 << " ";
else if (n % 3 == 1)
cout << n / 3 - 1 + 4 << " "; // 4是4张手推结果
else
cout << n / 3 - 1 + 3 << " "; // 3是5张手推结果
}
int main() {
for (int i = 1; i <= 20; i++) solve(i);
return 0;
}