제출 #22253

#제출 시각아이디문제언어결과실행 시간메모리
22253King_God_OnionPringles (#40)Fully Generate (KRIII5_FG)C++98
2 / 7
500 ms392644 KiB
#include<bits/stdc++.h>
#define je 1000000007
using namespace std;

long long gop(int x, int y){
    long long poww = x;
    long long ans = 1;
    int left = y;
    while(left){
        if(left & 1){
            ans = (ans * poww) % je;
        }
        poww = (poww * poww) % je;
        left >>= 1;
    }
    return ans;
}

int cnt[100000001];

int main(){
    long long n;
    scanf("%lld",&n);
    long long ans = 1;
    int pnt = 1, now = 2;
    for(int i=1;;i++){
        if(i<=2){
            cnt[i] = i;
        }else{
            if(pnt == 0){
                now++;
                pnt = cnt[now];
            }
            cnt[i] = now;
            pnt--;
        }
        if(n <= cnt[i]){
            ans = (ans * gop(i,n)) % je;
            break;
        }else{
            n -= cnt[i];
            ans = (ans * gop(i,cnt[i])) % je;
        }
    }
    printf("%lld",ans);
}

컴파일 시 표준 에러 (stderr) 메시지

FG.cpp: In function 'int main()':
FG.cpp:23:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...