結果
| 問題 |
No.1343 Dividing Digit
|
| コンテスト | |
| ユーザー |
57tggx
|
| 提出日時 | 2021-03-05 13:24:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 373 bytes |
| コンパイル時間 | 610 ms |
| コンパイル使用メモリ | 71,900 KB |
| 最終ジャッジ日時 | 2025-01-19 10:21:03 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
using lint = long long;
int main(){
lint n, k;
std::cin >> n >> k;
std::vector<lint> a(n);
lint sum = 0;
for(lint &i : a){
std::cin >> i;
sum += i;
}
lint tmp = 1;
lint ans = 0;
for(auto it = a.rbegin(); it != a.rend(); ++it){
ans = (ans + *it * tmp) % sum;
tmp = tmp * k % sum;
}
std::cout << ans << std::endl;
}
57tggx