提交时间:2023-11-27 13:11:57
运行 ID: 112572
#include<bits/stdc++.h> using namespace std; int cf(int n){ int a,i,s = 1; a = n / 3; for(i = 1;i <= a;i++){ s = s * 3; } return s; } int main(){ int i,n,a; cin>>n; a = cf(n); if(n % 3 == 0){ cout<<cf(n)<<endl; }else if(n % 3 == 1){ cout<<cf(n) / 3 * 4; }else{ cout<<cf(n) / 9 * 16; } }