結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー daijidalidaijidali
提出日時 2018-12-05 20:28:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 2,905 ms
コンパイル使用メモリ 72,560 KB
実行使用メモリ 56,588 KB
最終ジャッジ日時 2023-09-27 11:00:14
合計ジャッジ時間 6,686 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
56,588 KB
testcase_01 AC 112 ms
55,800 KB
testcase_02 AC 113 ms
56,108 KB
testcase_03 AC 114 ms
55,656 KB
testcase_04 AC 112 ms
56,060 KB
testcase_05 AC 109 ms
55,716 KB
testcase_06 AC 112 ms
56,156 KB
testcase_07 AC 111 ms
56,336 KB
testcase_08 AC 112 ms
55,660 KB
testcase_09 AC 109 ms
55,744 KB
testcase_10 AC 110 ms
55,936 KB
testcase_11 AC 112 ms
56,260 KB
testcase_12 AC 111 ms
55,976 KB
testcase_13 AC 112 ms
55,644 KB
testcase_14 AC 113 ms
56,160 KB
testcase_15 AC 113 ms
56,004 KB
testcase_16 AC 114 ms
55,692 KB
testcase_17 AC 111 ms
56,148 KB
testcase_18 AC 119 ms
55,620 KB
testcase_19 AC 113 ms
55,740 KB
testcase_20 AC 112 ms
55,596 KB
testcase_21 AC 113 ms
55,884 KB
testcase_22 AC 110 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package _test;

import java.util.Scanner;

public class No756 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int length = 0;
		int ans = 0;
		for (int i = 1; i <= 100; i++) {
//			System.out.print(i);
			if (i < 10)
				length += 1;
			else if (i < 100)
				length += 2;
			else
				length += 3;

			if (length >= D) {
				if (length == D) {
					ans = i % 10;
				} else {
					if (i < 100) {
						ans = i / 10;
					} else {
						ans = i / 100;
					}
				}
				break;
			}
		}
//		System.out.println("");
		System.out.println(ans);
	}
}
0