Submission #420768

#TimeUsernameProblemLanguageResultExecution timeMemory
420768qwerasdfzxclAsceticism (JOI18_asceticism)C++14
0 / 100
1 ms252 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int MOD = 1e9+7; ll pw(ll a, ll e){ if (!e) return 1; ll ret = pw(a, e/2); if (e&1) return ret*ret%MOD*a%MOD; return ret*ret%MOD; } int main(){ int n, k; scanf("%d %d", &n, &k); ll ans = 0, tmp = 1; for (int i=k;i;i--){ ans += pw(i, n)*tmp; tmp = (-tmp*(n+1-k+i)%MOD)*pw(k-i+1, MOD-2)%MOD; if (tmp<0) tmp += MOD; } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

asceticism.cpp: In function 'int main()':
asceticism.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...