Submission #22253

#TimeUsernameProblemLanguageResultExecution timeMemory
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); }

Compilation message (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...