結果

問題 No.1595 The Final Digit
ユーザー e869120e869120
提出日時 2021-05-03 13:37:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 338 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 65,240 KB
実行使用メモリ 134,536 KB
最終ジャッジ日時 2023-09-14 06:41:37
合計ジャッジ時間 9,427 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

long long p, q, r, K;
long long A[1 << 24];

int main() {
	// Step #1. Input
	cin >> p >> q >> r >> K;
	A[1] = p % 10LL;
	A[2] = q % 10LL;
	A[3] = r % 10LL;

	// Step #2. Solve
	for (long long i = 4; i <= K; i++) A[i] = (A[i - 1] + A[i - 2] + A[i - 3]) % 10LL;
	cout << A[K] << endl;
	return 0;
}
0