#include <iostream> #include <vector> using namespace std; int deal(int n) { if (n <= 3) return n-1; int res = 1; while (n > 4) { res *= 3; n -= 3; } res *= n; return res; } int main() { int n; while (cin >> n) { cout << deal(n) << endl; } return 0; }
原文:https://www.cnblogs.com/immjc/p/9455754.html