結果

問題 No.220 世界のなんとか2
ユーザー bal4ubal4u
提出日時 2019-08-25 07:23:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 352 bytes
コンパイル時間 848 ms
コンパイル使用メモリ 27,844 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-05 18:40:17
合計ジャッジ時間 1,949 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

// yukicoder: No.220 世界のなんとか2
// bal4u 2019.8.25

#include <stdio.h>

typedef long long ll;

ll a[22] = {0,3};

int main()
{
	int i, P; ll b10, ans;

	scanf("%d", &P);
	if (P == 1) ans = 3;
	else {
		b10 = 1; for (i = 2; i <= P; i++) {
			b10 *= 10;
			a[i] = 9*(a[i-1]+1)+b10-1;
		}
		ans = a[P];
	}
	printf("%lld\n", ans);
	return 0;
}
0