#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { // 注意 while 处理多个 case int result = 1; if(n < 4){//小于4输出本身-1 cout << n - 1 << endl; } else if(n == 4){ cout << 4 << endl; } while (n > 4) {//尽可能地分割成3 result *= 3; n -= 3; } result *= n; cout << result << endl; } return 0; } // 64 位输出请用 printf("%lld")