結果
問題 | No.1343 Dividing Digit |
ユーザー |
|
提出日時 | 2021-01-16 13:08:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 1,371 ms |
コンパイル使用メモリ | 168,652 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 13:11:58 |
合計ジャッジ時間 | 2,468 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int N,K;cin>>N>>K;int H=0; vector<int>V(N); for(int X=0;X<N;X++){ cin>>V[X];H+=V[X]; } reverse(V.begin(),V.end()); int U=1; int S=0; for(int X=0;X<N;X++){ U%=H;V[X]%=H;S+=(U*V[X])%H;S%=H; U*=K; } cout<<S<<endl; }