結果

問題 No.112 ややこしい鶴亀算
ユーザー shinwisteriashinwisteria
提出日時 2019-01-24 19:54:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 75,072 KB
実行使用メモリ 58,936 KB
最終ジャッジ日時 2023-10-14 09:42:54
合計ジャッジ時間 7,989 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,148 KB
testcase_01 AC 131 ms
57,208 KB
testcase_02 AC 129 ms
57,096 KB
testcase_03 AC 133 ms
56,824 KB
testcase_04 AC 134 ms
56,672 KB
testcase_05 WA -
testcase_06 AC 125 ms
56,700 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 129 ms
57,244 KB
testcase_10 AC 128 ms
56,876 KB
testcase_11 AC 139 ms
56,728 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 138 ms
56,788 KB
testcase_15 AC 133 ms
55,340 KB
testcase_16 WA -
testcase_17 AC 132 ms
56,768 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 137 ms
56,876 KB
testcase_21 AC 134 ms
56,804 KB
testcase_22 AC 138 ms
56,676 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;
public class No112 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.nextLine();
		ArrayList al = new ArrayList();
		for(int i = 0;i < n;i++){
			al.add(s.nextInt());
		}
		s.close();

		if(al.size() == 1){
			int ans = (int)al.get(0) / 2 - n;
			System.out.println(ans + " " + ans);
		}else{
			int a = ((int)al.get(0) + (int)al.get(1)) / 2 + 3;
			int k = a / 2 - n;
			System.out.println(n - k + " " + k);
		}

	}

}
0