結果

問題 No.91 赤、緑、青の石
ユーザー fjafjafjafjafjafja
提出日時 2017-10-03 22:45:45
言語 Java19
(openjdk 21)
結果
AC  
実行時間 217 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 3,225 ms
コンパイル使用メモリ 78,188 KB
実行使用メモリ 56,580 KB
最終ジャッジ日時 2023-09-06 12:33:31
合計ジャッジ時間 9,912 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
56,180 KB
testcase_01 AC 183 ms
55,736 KB
testcase_02 AC 183 ms
56,384 KB
testcase_03 AC 194 ms
56,324 KB
testcase_04 AC 190 ms
56,360 KB
testcase_05 AC 208 ms
56,068 KB
testcase_06 AC 194 ms
56,172 KB
testcase_07 AC 123 ms
55,912 KB
testcase_08 AC 127 ms
55,632 KB
testcase_09 AC 125 ms
55,860 KB
testcase_10 AC 125 ms
55,924 KB
testcase_11 AC 181 ms
56,008 KB
testcase_12 AC 217 ms
55,744 KB
testcase_13 AC 188 ms
56,468 KB
testcase_14 AC 204 ms
56,412 KB
testcase_15 AC 204 ms
56,164 KB
testcase_16 AC 124 ms
55,868 KB
testcase_17 AC 123 ms
56,132 KB
testcase_18 AC 126 ms
55,992 KB
testcase_19 AC 125 ms
55,844 KB
testcase_20 AC 123 ms
55,704 KB
testcase_21 AC 124 ms
55,756 KB
testcase_22 AC 125 ms
56,232 KB
testcase_23 AC 124 ms
55,816 KB
testcase_24 AC 124 ms
55,556 KB
testcase_25 AC 200 ms
56,580 KB
testcase_26 AC 198 ms
56,220 KB
testcase_27 AC 164 ms
56,188 KB
testcase_28 AC 179 ms
56,304 KB
testcase_29 AC 168 ms
56,108 KB
testcase_30 AC 188 ms
56,132 KB
testcase_31 AC 193 ms
56,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N091 {
	static int[] s;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		s=new int[3];
		for(int i=0;i<3;i++){
			s[i]=sc.nextInt();
		}
		int cnt=0;
		suply();

		while(s[0]>=1&&s[1]>=1&&s[2]>=1){
			for(int i=0;i<3;i++){
				s[i]--;
			}
			cnt++;
			suply();
		}
		System.out.println(cnt);
	}
	static void suply(){
		if((s[0]>=1&&s[1]>=1&&s[2]>=1)){
			return;
		}
		int max=0;
		int maxi=0;
		int min=Integer.MAX_VALUE;
		int mini=0;
		int cnt=0;
		while(!(s[0]>=1&&s[1]>=1&&s[2]>=1)&&cnt<3){
			for(int i=0;i<3;i++){
				if(s[i]>=max){
					max=s[i];
					maxi=i;
				}
				if(s[i]<=min){
					min=s[i];
					mini=i;
				}
			}
			s[maxi]-=2;s[mini]+=1;
			cnt++;
		}
		return;
	}
}
0