結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー tentententen
提出日時 2021-01-25 09:38:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 374 ms / 1,000 ms
コード長 660 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 79,024 KB
実行使用メモリ 63,304 KB
最終ジャッジ日時 2023-09-03 20:05:19
合計ジャッジ時間 14,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
57,100 KB
testcase_01 AC 133 ms
56,776 KB
testcase_02 AC 138 ms
56,944 KB
testcase_03 AC 134 ms
57,096 KB
testcase_04 AC 135 ms
56,892 KB
testcase_05 AC 138 ms
57,096 KB
testcase_06 AC 138 ms
56,784 KB
testcase_07 AC 135 ms
57,080 KB
testcase_08 AC 140 ms
57,012 KB
testcase_09 AC 142 ms
56,648 KB
testcase_10 AC 139 ms
56,576 KB
testcase_11 AC 139 ms
56,492 KB
testcase_12 AC 137 ms
56,740 KB
testcase_13 AC 304 ms
61,848 KB
testcase_14 AC 308 ms
61,660 KB
testcase_15 AC 201 ms
59,088 KB
testcase_16 AC 280 ms
60,200 KB
testcase_17 AC 339 ms
61,868 KB
testcase_18 AC 296 ms
60,300 KB
testcase_19 AC 365 ms
63,304 KB
testcase_20 AC 317 ms
61,816 KB
testcase_21 AC 310 ms
60,604 KB
testcase_22 AC 312 ms
62,200 KB
testcase_23 AC 312 ms
62,300 KB
testcase_24 AC 338 ms
62,236 KB
testcase_25 AC 313 ms
61,916 KB
testcase_26 AC 331 ms
61,640 KB
testcase_27 AC 333 ms
62,200 KB
testcase_28 AC 334 ms
61,824 KB
testcase_29 AC 363 ms
62,392 KB
testcase_30 AC 374 ms
62,516 KB
testcase_31 AC 346 ms
62,244 KB
testcase_32 AC 362 ms
61,940 KB
testcase_33 AC 317 ms
61,880 KB
testcase_34 AC 326 ms
62,040 KB
testcase_35 AC 134 ms
56,764 KB
testcase_36 AC 137 ms
56,800 KB
testcase_37 AC 138 ms
56,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        HashMap<Character, Integer> counts = new HashMap<>();
        HashMap<Character, Integer> idx = new HashMap<>();
        for (int i = 1; i <= arr.length; i++) {
            counts.put(arr[i - 1], counts.getOrDefault(arr[i - 1], 0) + 1);
            idx.put(arr[i - 1], i);
        }
        for (char c : counts.keySet()) {
            if (counts.get(c) == 1) {
                System.out.println(idx.get(c) + " " + c);
                return;
            }
        }
    }
}
0