結果
問題 |
No.1343 Dividing Digit
|
ユーザー |
|
提出日時 | 2024-03-23 16:08:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 528 bytes |
コンパイル時間 | 4,396 ms |
コンパイル使用メモリ | 250,464 KB |
最終ジャッジ日時 | 2025-02-20 13:23:34 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 22 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int N, K, A[101010]; ll sum, ans, powK[101010]; int main() { cin >> N >> K; for (int i = N; i >= 1; i--) { cin >> A[i]; sum += A[i]; } powK[1] = 1; for (int i = 2; i <= N; i++) { powK[i] = (powK[i - 1] * K) % sum; } for (int i = 1; i <= N; i++) { ans = (ans + (A[i] * powK[i]) % sum) % sum; } cout << sum << endl; cout << ans << endl; return 0; }