結果
| 問題 |
No.1343 Dividing Digit
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-01-16 13:04:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 331 bytes |
| コンパイル時間 | 2,212 ms |
| コンパイル使用メモリ | 191,616 KB |
| 最終ジャッジ日時 | 2025-01-17 21:33:04 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%d",&N,&K);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | rep(i,N) scanf("%d",&A[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int N,K;
int A[100000];
ULL M=0;
int main(){
scanf("%d%d",&N,&K);
rep(i,N) scanf("%d",&A[i]);
rep(i,N) M+=A[i];
ULL S=0;
rep(i,N) S=(S*K+A[i])%M;
printf("%llu\n",S);
return 0;
}
Nachia