結果

問題 No.1343 Dividing Digit
ユーザー aa
提出日時 2021-02-14 22:42:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 37,996 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 16:28:01
合計ジャッジ時間 1,583 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int keta(int N,int keta,int K){
    for(int 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){
    int N=read();
    int K=read();
    int x = 0;
    int y = 0;
    int buf = 0;
    for(int i = 0;i<N;i++){
        x += (pow(K,N-1-i)*(buf=read()));
        y +=buf;
    }
    printf("%d",x%y);
    return 0;
    
}
0