結果

問題 No.112 ややこしい鶴亀算
ユーザー リチウムリチウム
提出日時 2014-12-24 00:10:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 569 bytes
コンパイル時間 3,824 ms
コンパイル使用メモリ 76,156 KB
実行使用メモリ 58,544 KB
最終ジャッジ日時 2023-09-02 22:26:55
合計ジャッジ時間 8,471 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
56,668 KB
testcase_01 AC 138 ms
55,740 KB
testcase_02 AC 153 ms
57,036 KB
testcase_03 AC 152 ms
56,860 KB
testcase_04 AC 138 ms
56,168 KB
testcase_05 AC 138 ms
56,048 KB
testcase_06 AC 154 ms
56,748 KB
testcase_07 AC 152 ms
56,912 KB
testcase_08 AC 138 ms
55,936 KB
testcase_09 AC 142 ms
56,192 KB
testcase_10 AC 152 ms
55,304 KB
testcase_11 AC 154 ms
56,476 KB
testcase_12 AC 156 ms
56,808 KB
testcase_13 AC 143 ms
56,276 KB
testcase_14 AC 148 ms
56,080 KB
testcase_15 AC 157 ms
57,004 KB
testcase_16 AC 156 ms
57,080 KB
testcase_17 AC 159 ms
56,548 KB
testcase_18 AC 156 ms
56,740 KB
testcase_19 AC 142 ms
55,836 KB
testcase_20 AC 143 ms
56,268 KB
testcase_21 AC 158 ms
56,852 KB
testcase_22 AC 159 ms
58,544 KB
testcase_23 AC 160 ms
57,088 KB
testcase_24 AC 144 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

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+4)System.out.println(0+" "+n);
			 else System.out.println(n+" "+0);
		 }
	 

}
}
0