結果
| 問題 | No.112 ややこしい鶴亀算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-18 18:01:12 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 67 ms / 5,000 ms |
| + 203µs | |
| コード長 | 777 bytes |
| 記録 | |
| コンパイル時間 | 2,652 ms |
| コンパイル使用メモリ | 87,916 KB |
| 実行使用メモリ | 43,584 KB |
| 最終ジャッジ日時 | 2026-09-19 20:03:13 |
| 合計ジャッジ時間 | 5,889 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
import java.util.Scanner;
public class Yuki4 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int leg[] = new int[n];
int x = 0;
int y = 0;
int z = -1;
for (int i = 0; i < n; i++) {
leg[i] = scan.nextInt();
}
for (int i = 0; i < n; i++) {
if (leg[0] == leg[i]) x++;
else z = i;
}
y = n - x;
if (2 * x + 4 * y == leg[0] + 2) {
if (z == -1) System.out.println(x + " " + y);
else if (2 * x + 4 * y == leg[z] + 4) System.out.println(x + " " + y);
else System.out.println(y + " " + x);
}
else System.out.println(y + " " + x);
}
}