結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー pengin_2000
提出日時 2019-07-06 22:33:09
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 13:32:50
合計ジャッジ時間 1,020 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int keta(int n)
{
	int res = 0;
	while (n > 0)
	{
		res++;
		n /= 10;
	}
	return res;
}
int main()
{
	int d;
	scanf("%d", &d);
	int i, j;
	for (i = 1;; i++)
	{
		if (d > keta(i))
			d -= keta(i);
		else
		{
			int ans = i;
			for (j = 0; j < keta(i) - d; j++)
				ans /= 10;
			printf("%d\n", ans % 10);
			return 0;
		}
	}
}
0