답안 #22924

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22924 2017-04-30T13:19:54 Z solarmagic Fully Generate (KRIII5_FG) C++14
컴파일 오류
0 ms 0 KB
#include<stdio.h>
const int M=((ll)1e9+7)
typedef long long ll;
ll n,a[32000000];
ll f(ll a, ll b) {
    if(!b) return 1;
    if(b & 1) return f(a,b-1) * a % M;
    ll k = f(a, b>>1);
    return k*k%M;
}
int main() {
    scanf("%lld",&n);
    if(n <= 11) {
        ll r[12] = {0,1,2,4,12,36,144,576,2304,11520,57600,288000};
        printf("%lld", r[n]);
    } else {
        a[1] = 1, a[2] = 2, a[3] = 2, a[4] = 3, a[5] = 3;
        ll res = 1, i=4, s=5;
        ll tmp = 6;
        for(ll j=6;s+a[i]<n;i++) {
            for(ll k=0;j<32000000 && k<a[i];k++) a[j++] = i;
            s += a[i];
            if(a[i] == a[i-1]) tmp = (tmp * i) % M;
            else res = (res * f(tmp, a[i-1])) % M, tmp = i;
        }
        res = (res * f(tmp, a[i-1])) % M;
        res = (res * f(i, n-s)) % M;
        printf("%lld", res);
    }
    return 0;
}

Compilation message

FG.cpp:2:15: error: 'll' was not declared in this scope
 const int M=((ll)1e9+7)
               ^
FG.cpp:2:18: error: expected ')' before numeric constant
 const int M=((ll)1e9+7)
                  ^
FG.cpp:4:1: error: 'll' does not name a type
 ll n,a[32000000];
 ^
FG.cpp:5:1: error: 'll' does not name a type
 ll f(ll a, ll b) {
 ^
FG.cpp: In function 'int main()':
FG.cpp:12:19: error: 'n' was not declared in this scope
     scanf("%lld",&n);
                   ^
FG.cpp:14:9: error: 'll' was not declared in this scope
         ll r[12] = {0,1,2,4,12,36,144,576,2304,11520,57600,288000};
         ^
FG.cpp:15:24: error: 'r' was not declared in this scope
         printf("%lld", r[n]);
                        ^
FG.cpp:17:9: error: 'a' was not declared in this scope
         a[1] = 1, a[2] = 2, a[3] = 2, a[4] = 3, a[5] = 3;
         ^
FG.cpp:18:9: error: 'll' was not declared in this scope
         ll res = 1, i=4, s=5;
         ^
FG.cpp:19:12: error: expected ';' before 'tmp'
         ll tmp = 6;
            ^
FG.cpp:20:16: error: expected ';' before 'j'
         for(ll j=6;s+a[i]<n;i++) {
                ^
FG.cpp:20:20: error: 's' was not declared in this scope
         for(ll j=6;s+a[i]<n;i++) {
                    ^
FG.cpp:20:24: error: 'i' was not declared in this scope
         for(ll j=6;s+a[i]<n;i++) {
                        ^
FG.cpp:21:20: error: expected ';' before 'k'
             for(ll k=0;j<32000000 && k<a[i];k++) a[j++] = i;
                    ^
FG.cpp:21:24: error: 'j' was not declared in this scope
             for(ll k=0;j<32000000 && k<a[i];k++) a[j++] = i;
                        ^
FG.cpp:21:38: error: 'k' was not declared in this scope
             for(ll k=0;j<32000000 && k<a[i];k++) a[j++] = i;
                                      ^
FG.cpp:23:32: error: 'tmp' was not declared in this scope
             if(a[i] == a[i-1]) tmp = (tmp * i) % M;
                                ^
FG.cpp:24:18: error: 'res' was not declared in this scope
             else res = (res * f(tmp, a[i-1])) % M, tmp = i;
                  ^
FG.cpp:24:33: error: 'tmp' was not declared in this scope
             else res = (res * f(tmp, a[i-1])) % M, tmp = i;
                                 ^
FG.cpp:24:44: error: 'f' was not declared in this scope
             else res = (res * f(tmp, a[i-1])) % M, tmp = i;
                                            ^
FG.cpp:26:9: error: 'res' was not declared in this scope
         res = (res * f(tmp, a[i-1])) % M;
         ^
FG.cpp:26:24: error: 'tmp' was not declared in this scope
         res = (res * f(tmp, a[i-1])) % M;
                        ^
FG.cpp:26:31: error: 'i' was not declared in this scope
         res = (res * f(tmp, a[i-1])) % M;
                               ^
FG.cpp:26:35: error: 'f' was not declared in this scope
         res = (res * f(tmp, a[i-1])) % M;
                                   ^
FG.cpp:27:29: error: 's' was not declared in this scope
         res = (res * f(i, n-s)) % M;
                             ^