結果

問題 No.91 赤、緑、青の石
ユーザー リチウムリチウム
提出日時 2014-12-07 20:39:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,569 bytes
コンパイル時間 5,451 ms
コンパイル使用メモリ 74,364 KB
実行使用メモリ 50,760 KB
最終ジャッジ日時 2023-09-02 10:22:24
合計ジャッジ時間 8,407 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
49,992 KB
testcase_01 AC 46 ms
50,200 KB
testcase_02 AC 48 ms
50,152 KB
testcase_03 AC 48 ms
48,332 KB
testcase_04 AC 46 ms
50,352 KB
testcase_05 AC 47 ms
50,196 KB
testcase_06 WA -
testcase_07 AC 42 ms
49,216 KB
testcase_08 AC 43 ms
48,948 KB
testcase_09 AC 43 ms
49,524 KB
testcase_10 AC 42 ms
49,308 KB
testcase_11 AC 46 ms
50,672 KB
testcase_12 AC 48 ms
50,760 KB
testcase_13 AC 46 ms
50,132 KB
testcase_14 AC 46 ms
50,420 KB
testcase_15 AC 48 ms
50,388 KB
testcase_16 AC 42 ms
49,040 KB
testcase_17 AC 42 ms
49,208 KB
testcase_18 AC 42 ms
49,044 KB
testcase_19 AC 42 ms
48,964 KB
testcase_20 AC 42 ms
49,232 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 42 ms
48,980 KB
testcase_24 AC 42 ms
49,224 KB
testcase_25 AC 46 ms
50,188 KB
testcase_26 AC 46 ms
50,392 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 42 ms
49,472 KB
testcase_31 AC 45 ms
50,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.Math.*;
public class ppp {
			
  public static void main(String[] args) {
	  MyScanner sc=new MyScanner();
	 int r=sc.nextInt();
	 int g=sc.nextInt();
	 int b=sc.nextInt();
	 int c[]={r,g,b};
	 Arrays.sort(c);
	 int ans=0;
	 do{
		ans+=c[0];
		c[2]-=c[0];
		c[1]-=c[0];
		c[0]-=c[0];
		int x=Math.min(c[1],(c[2]-c[1])/2);
		c[2]-=x*2;
		c[0]=x;
		ans+=c[0];
		c[2]-=c[0];
		c[1]-=c[0];
		c[0]-=c[0];
		Arrays.sort(c);
		if(c[1]>10000){
			c[2]-=5000;
			c[1]-=5000;
			c[0]+=5000;
		}
		else{
			if(c[2]-c[0]>2){
				c[2]-=2;
				c[0]++;
				Arrays.sort(c);
			}
		}
	 }while(c[0]!=0);
	 System.out.println(ans);
	 
	 
  }
}

class MyScanner {
	int nextInt() {
		try {
			int c = System.in.read();
			while (c != '-' && (c < '0' || '9' < c))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = System.in.read();
			} while ('0' <= c && c <= '9');
			return res;
		} catch (Exception e) {
			return -1;
		}
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	String next() {
		try {
			StringBuilder res = new StringBuilder("");
			int c = System.in.read();
			while (Character.isWhitespace(c))
				c = System.in.read();
			do {
				res.append((char) c);
			} while (!Character.isWhitespace(c = System.in.read()));
			return res.toString();
		} catch (Exception e) {
			return null;
		}
	}
}
0