結果

問題 No.2778 Is there Same letter?
ユーザー ks2mks2m
提出日時 2024-06-07 21:24:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 75,512 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2024-06-07 21:24:14
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
54,092 KB
testcase_01 AC 123 ms
53,748 KB
testcase_02 AC 139 ms
54,120 KB
testcase_03 AC 121 ms
54,076 KB
testcase_04 AC 124 ms
53,808 KB
testcase_05 AC 126 ms
54,128 KB
testcase_06 AC 112 ms
53,068 KB
testcase_07 AC 124 ms
54,200 KB
testcase_08 AC 125 ms
54,100 KB
testcase_09 AC 120 ms
53,852 KB
testcase_10 AC 123 ms
53,892 KB
testcase_11 AC 120 ms
54,096 KB
testcase_12 AC 123 ms
54,056 KB
testcase_13 AC 120 ms
54,032 KB
testcase_14 AC 124 ms
54,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();

		Set<Character> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
			if (!set.add(s[i])) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}
0