結果

問題 No.742 にゃんにゃんにゃん 猫の挨拶
ユーザー htensaihtensai
提出日時 2020-02-17 12:19:46
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 2,380 ms
コンパイル使用メモリ 75,568 KB
実行使用メモリ 43,452 KB
最終ジャッジ日時 2024-04-16 03:48:35
合計ジャッジ時間 7,545 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
37,072 KB
testcase_01 AC 55 ms
36,916 KB
testcase_02 AC 56 ms
37,096 KB
testcase_03 AC 56 ms
36,792 KB
testcase_04 AC 59 ms
36,712 KB
testcase_05 AC 69 ms
37,336 KB
testcase_06 AC 101 ms
39,604 KB
testcase_07 AC 124 ms
42,992 KB
testcase_08 AC 163 ms
43,452 KB
testcase_09 AC 55 ms
36,740 KB
testcase_10 AC 55 ms
36,932 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		HashSet<Integer> used = new HashSet<>();
		int count = 0;
		for (int i = 0; i < n; i++) {
		    int x = Integer.parseInt(br.readLine());
		    for (int j = 1; j < x; j++) {
		        if (!used.contains(j)) {
		            count++;
		        }
		    }
		    used.add(x);
		}
		System.out.println(count);
    }
}
0