結果

問題 No.1595 The Final Digit
ユーザー Bas_shiiBas_shii
提出日時 2021-07-09 22:23:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 320 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 68,780 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-14 09:37:30
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int main(){
    long p,q,r,k;cin >> p >> q >> r >> k;
    vector<int> calc(k);
    calc[0]=p%10;
    calc[1]=q%10;
    calc[2]=r%10;
    for(int i=3;i<k;i++){
        calc[i]=(calc[i-1]+calc[i-2]+calc[i-3])%10;
    }
    cout << calc[k-1] << endl;
    return 0;
}
0