結果

問題 No.220 世界のなんとか2
ユーザー bal4u
提出日時 2019-08-25 07:23:36
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 352 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 28,416 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-15 15:46:08
合計ジャッジ時間 1,458 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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