結果
| 問題 | No.1438 Broken Drawers |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2021-03-26 21:29:31 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 446 ms / 2,000 ms |
| コード長 | 482 bytes |
| 記録 | |
| コンパイル時間 | 4,595 ms |
| コンパイル使用メモリ | 80,728 KB |
| 実行使用メモリ | 57,364 KB |
| 最終ジャッジ日時 | 2026-05-22 19:36:21 |
| 合計ジャッジ時間 | 11,222 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
sc.close();
int ans = 1;
int cnt = 0;
for (int i = 1; i < n; i++) {
if (a[i - 1] < a[i]) {
ans++;
ans += cnt / 2;
cnt = 0;
} else {
cnt++;
}
}
ans += cnt / 2;
System.out.println(ans);
}
}
ks2m