結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2016-05-01 23:49:13 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 209 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 2,008 ms |
コンパイル使用メモリ | 74,168 KB |
実行使用メモリ | 60,484 KB |
最終ジャッジ日時 | 2024-10-12 02:13:45 |
合計ジャッジ時間 | 8,195 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
import java.util.*; import java.io.*; class prob365 { public static void main(String args[])throws IOException { BufferedReader sc=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(sc.readLine()); String s[]=sc.readLine().split(" "); int a[]=new int[n]; for(int i=0;i<n;i++)a[i]=Integer.parseInt(s[i]); int ans=n; int target=n; for(int i=n-1;i>=0;i--) { if(target==a[i]) { ans--; target--; } } System.out.println(ans); } }