1 条题解

  • 0
    @ 2026-6-13 19:06:41
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    	int N;
    	long  long int s = 1;
    	scanf("%d", &N);
    	if (N == 2)
    		cout << "1";
    	else if (N == 3)
    		cout << "2";
    	else if (N == 4)
    		cout << "4";
    	else if (N > 4) {
    		for (int i = 1; i < 40; i++) {
    			s = s * 3;
    			if ((N - 3 * i) == 4 || (N - 3 * i) == 2) {
    
    				s = s * (N - 3 * i);
    				printf("%lld", s);
    				break;
    			} else if ((N - 3 * i) == 0 ) {
    				printf("%lld", s);
    				break;
    
    			}
    		}
    
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    31123
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    355
    已通过
    6
    上传者