結果
問題 |
No.742 にゃんにゃんにゃん 猫の挨拶
|
ユーザー |
![]() |
提出日時 | 2020-02-17 12:19:46 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 554 bytes |
コンパイル時間 | 2,232 ms |
コンパイル使用メモリ | 74,928 KB |
実行使用メモリ | 43,536 KB |
最終ジャッジ日時 | 2024-10-06 14:54:30 |
合計ジャッジ時間 | 7,254 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 TLE * 1 -- * 4 |
ソースコード
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); } }