# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22383 | 2017-04-30T04:20:18 Z | 예제는 나오는데 왜 틀리죠??(#895, baactree) | Fully Generate (KRIII5_FG) | C++14 | 406 ms | 1048576 KB |
// ===================================================================================== // // Filename: fg.cpp // Created: 2017년 04월 30일 12시 39분 09초 // Compiler: g++ -O2 -std=c++14 // Author: baactree , [email protected] // Company: Chonnam National University // // ===================================================================================== #include <bits/stdc++.h> using namespace std; const int mod=1000000007; typedef long long ll; ll _pow(ll a, ll b){ if(b==0) return 1; ll temp=_pow(a, b/2); temp=(temp*temp)%mod; if(b&1) return (temp*a)%mod; return temp; } int main(){ int cnt=1; int idx=1; vector<int> arr; arr.push_back(0); arr.push_back(1); arr.push_back(2); arr.push_back(2); for(int i=3;i<60000;i++){ for(int j=0;j<arr[i];j++) arr.push_back(i); } vector<long long> sum; sum.push_back(0); for(int i=1;i<arr.size();i++) sum.push_back(sum[i-1]+arr[i]); long long n; scanf("%lld", &n); int k; for(int i=0;i<sum.size();i++){ if(sum[i]>n){ k=i; break; } } ll ans=1; for(int i=1;i<k;i++){ ans=(ans*_pow(i, arr[i]))%mod; n-=arr[i]; } ans=(ans*_pow(k, n))%mod; printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 406 ms | 1048576 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 406 ms | 1048576 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |