結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2014-12-08 22:38:02 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 5,000 ms |
| コード長 | 919 bytes |
| 記録 | |
| コンパイル時間 | 2,299 ms |
| コンパイル使用メモリ | 79,608 KB |
| 実行使用メモリ | 46,708 KB |
| 最終ジャッジ日時 | 2025-12-07 12:20:58 |
| 合計ジャッジ時間 | 6,599 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = sc.nextInt();
int g = sc.nextInt();
int b = sc.nextInt();
int min = Math.min(r, Math.min(g,b));
int max = Math.max(r, Math.max(g,b));
while(min<=max){
int temp=(min+max)/2;
int count=0;
if(temp>r){
count-=(temp-r);
}else{
count+=(r-temp)/2;
}
if(temp>g){
count-=(temp-g);
}else{
count+=(g-temp)/2;
}
if(temp>b){
count-=(temp-b);
}else{
count+=(b-temp)/2;
}
if(count>=0){
min=temp+1;
}else{
max=temp-1;
}
}
System.out.println(Math.min(min,max));
}
}
kou6839