結果

問題 No.112 ややこしい鶴亀算
ユーザー リチウムリチウム
提出日時 2014-12-24 00:08:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 4,022 ms
コンパイル使用メモリ 75,784 KB
実行使用メモリ 57,120 KB
最終ジャッジ日時 2023-09-02 22:26:43
合計ジャッジ時間 9,130 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
56,688 KB
testcase_01 AC 138 ms
56,188 KB
testcase_02 AC 153 ms
56,636 KB
testcase_03 AC 154 ms
56,600 KB
testcase_04 AC 141 ms
55,836 KB
testcase_05 WA -
testcase_06 AC 154 ms
56,972 KB
testcase_07 AC 154 ms
56,700 KB
testcase_08 WA -
testcase_09 AC 139 ms
56,136 KB
testcase_10 AC 155 ms
57,064 KB
testcase_11 AC 156 ms
56,664 KB
testcase_12 AC 159 ms
56,584 KB
testcase_13 WA -
testcase_14 AC 144 ms
56,076 KB
testcase_15 AC 158 ms
56,996 KB
testcase_16 AC 158 ms
57,052 KB
testcase_17 AC 158 ms
56,868 KB
testcase_18 AC 157 ms
56,972 KB
testcase_19 WA -
testcase_20 AC 144 ms
56,124 KB
testcase_21 AC 158 ms
56,544 KB
testcase_22 AC 159 ms
57,120 KB
testcase_23 AC 161 ms
56,824 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class LightSwitchingPuzzle {
	
	
	 public static void main(String[] args) {
		 Scanner sc=new Scanner(System.in);
		 TreeSet<Integer>asi=new TreeSet<>();
		 int n=sc.nextInt();
		 for(int i=0;i<n;i++){
			 asi.add(sc.nextInt());
		 }
		 if(asi.size()==2){
			 int f=asi.first()+4;
			 int kame=(f-2*n)/2;
			 int turu=n-kame;
			 System.out.println(turu+" "+kame);
		/*2x+2y=2n
		2x+4y=f		 
        2y=f-2n*/
		 }
		 else {
			 int f=asi.first();
			 if(n*4==f)System.out.println(0+" "+n);
			 else System.out.println(n+" "+0);
		 }
	 

}
}
0