結果
問題 |
No.1343 Dividing Digit
|
ユーザー |
|
提出日時 | 2021-02-14 22:44:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 598 bytes |
コンパイル時間 | 466 ms |
コンパイル使用メモリ | 39,168 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-22 10:37:35 |
合計ジャッジ時間 | 1,498 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 22 |
ソースコード
#include <stdio.h> #include <math.h> long keta(long N,long keta,long K){ for(long i =0;i<=keta;i++){ N*=keta; } return keta; } int read(){ int x=0; char c; while(((c=getchar())>'9' || c<'0')&&c!='-'); const int f=(c=='-')&&(c=getchar()); while(x=x*10-48+c,(c=getchar())>='0'&&c<='9'); return f?-x:x; } int main(void){ long N=read(); long K=read(); long long x = 0; long long y = 0; long long buf = 0; for(int i = 0;i<N;i++){ x += (pow(K,N-1-i)*(buf=read())); y +=buf; } printf("%dl",x%y); return 0; }