Submission #22702

#TimeUsernameProblemLanguageResultExecution timeMemory
22702STARBUCKS (#40)Fully Generate (KRIII5_FG)C++98
2 / 7
9 ms8248 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main () { int n; cin >> n; if(n > 1e6) { cout << -1 << endl; return 0; } vector<int> v(4); v[1] = 1; v[2] = 2; v[3] = 2; int c = 0; int prv = 0; for(int i=3; v.size()<=n; i++) { c = v[i]; while(c--) v.push_back(i); } ll r = 1; for(int i=1; i<=n; i++) { r = (r * v[i]) % 1000000007; } cout <<r << endl; return 0; }

Compilation message (stderr)

FG.cpp: In function 'int main()':
FG.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=3; v.size()<=n; i++)
                          ^
FG.cpp:22:9: warning: unused variable 'prv' [-Wunused-variable]
     int prv = 0;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...