結果

問題 No.1595 The Final Digit
ユーザー Bas_shii
提出日時 2021-07-09 23:38:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 397 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 65,920 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-01 18:29:13
合計ジャッジ時間 3,989 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int main() {
    long long p, q, r, k; cin >> p >> q >> r >> k;
    long one, two, three;
    one = p % 10;
    two = q % 10;
    three = r % 10;
    for (long long i = 3; i < k; i++) {
        long tmp = three;
        three = (one + two + three) % 10;
        one = two;
        two = tmp;
    }
    cout << three << endl;
    return 0;
}
0