結果
問題 | No.2607 Add One Digit |
ユーザー | Ryoichi Yamada |
提出日時 | 2024-01-19 21:38:15 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 184 ms / 1,000 ms |
コード長 | 899 bytes |
コンパイル時間 | 5,768 ms |
コンパイル使用メモリ | 81,804 KB |
実行使用メモリ | 58,872 KB |
最終ジャッジ日時 | 2024-01-19 21:38:27 |
合計ジャッジ時間 | 9,952 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 162 ms
58,724 KB |
testcase_01 | AC | 153 ms
58,604 KB |
testcase_02 | AC | 178 ms
58,856 KB |
testcase_03 | AC | 147 ms
58,620 KB |
testcase_04 | AC | 156 ms
58,852 KB |
testcase_05 | AC | 156 ms
58,728 KB |
testcase_06 | AC | 163 ms
58,828 KB |
testcase_07 | AC | 159 ms
58,728 KB |
testcase_08 | AC | 150 ms
58,588 KB |
testcase_09 | AC | 177 ms
58,836 KB |
testcase_10 | AC | 177 ms
58,828 KB |
testcase_11 | AC | 153 ms
58,836 KB |
testcase_12 | AC | 154 ms
58,724 KB |
testcase_13 | AC | 163 ms
58,844 KB |
testcase_14 | AC | 157 ms
58,872 KB |
testcase_15 | AC | 158 ms
58,852 KB |
testcase_16 | AC | 157 ms
58,860 KB |
testcase_17 | AC | 155 ms
58,728 KB |
testcase_18 | AC | 184 ms
58,724 KB |
testcase_19 | AC | 161 ms
58,736 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String s = sc.next(); sc.close(); Set<Long> set = new HashSet<>(); for (int k = 0; k <= s.length(); k++) { String pre; String post; int start = 0; if (k == 0) { pre = ""; post = s; start = 1; } else if (k == s.length()) { pre = s; post = ""; } else { pre = s.substring(0, k); post = s.substring(k); } for (int i = start; i <= 9; i++) { String numString = pre + i + post; set.add(Long.parseLong(numString)); } } System.out.println(set.size()); } }