Submission #1100847

#TimeUsernameProblemLanguageResultExecution timeMemory
1100847vincentbucourt1Calvinball championship (CEOI15_teams)C++14
0 / 100
2 ms336 KiB
#include <bits/stdc++.h> using namespace std; void fastIO() { ios_base::sync_with_stdio(false), cin.tie(0); } #define int long long const int MOD = 1e9 + 7; const int MAXN = 10001; int N; int vals[MAXN]; int ans = 0; long long modular(long long base, long long exp, int mod) { long long res = 1; while (exp > 0) { if (exp % 2 == 1) res= (res * base) % mod; exp = exp >> 1; base = (base * base) % mod; } return res; } signed main() { fastIO(); cin >> N; for (int i = 0; i < N; i++) { cin >> vals[i]; } reverse(vals, vals + N); for (int i = 0; i < N; i++) { ans += ((vals[i] - 1) * modular(N, i, MOD)) % MOD; ans %= MOD; } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...