Submission #22336

#TimeUsernameProblemLanguageResultExecution timeMemory
22336크리님 제가 귀여우면 됬지 뭘 더 원하세요 진짜 (#40)Fully Generate (KRIII5_FG)C++14
7 / 7
316 ms394472 KiB
#include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<list> #include<vector> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<functional> #include<cmath> #include<string> #define sd(a) scanf("%d", &a); #define sld(a) scanf("%lld", &a); #define MOD 1000000007 using namespace std; typedef long long int lli; typedef pair<int, int> ii; lli N; lli cal(lli A, lli B) { lli ret = 1; while (B != 0) { if (B % 2 == 0) { A *= A; A %= MOD; B /= 2; } else { ret *= A; ret %= MOD; B--; } } return ret; } vector<lli> ve; int main(void) { sld(N); ve.push_back(0); ve.push_back(1); ve.push_back(2); ve.push_back(2); if (N == 1) { printf("1"); return 0; } else if (N == 2) { printf("2"); return 0; } else if (N == 3) { printf("4"); return 0; } else if (N == 4) { printf("12"); return 0; } else if (N == 5) { printf("36"); return 0; } lli ind = 3; lli cur = ve[ind]; lli hap = 5; lli ans = 36; lli val = 1; for (int i = 4; ; i++) { if (cur == 0) { ans *= cal(val, ind); ans %= MOD; val = 1; ind++; cur = ve[ind]; } if (hap + ind >= N) { ans *= cal(val, ind); ans %= MOD; break; } val *= ve.size(); val %= MOD; ve.push_back(ind); hap += ind; cur--; } ans *= cal(ve.size(), N - hap); ans %= MOD; printf("%lld", ans); return 0; }

Compilation message (stderr)

FG.cpp: In function 'int main()':
FG.cpp:17:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define sld(a) scanf("%lld", &a);
                                 ^
FG.cpp:46:2: note: in expansion of macro 'sld'
  sld(N);
  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...