結果
| 問題 |
No.91 赤、緑、青の石
|
| ユーザー |
ぴろず
|
| 提出日時 | 2014-12-07 20:25:44 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 135 ms / 5,000 ms |
| コード長 | 874 bytes |
| コンパイル時間 | 2,498 ms |
| コンパイル使用メモリ | 75,212 KB |
| 実行使用メモリ | 54,376 KB |
| 最終ジャッジ日時 | 2024-06-24 06:44:58 |
| 合計ジャッジ時間 | 7,528 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
package no091;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static final int MAX = 10000000;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] m = new int[3];
for(int i=0;i<3;i++) {
m[i] = sc.nextInt();
}
int right = MAX+1;
int left = 0;
while(left + 1 < right) {
int center = (right + left) / 2;
int[] n = Arrays.copyOf(m, 3);
int need = 0;
for(int j=0;j<3;j++) {
if (n[j] < center) {
need += center - n[j];
n[j] = 0;
}else{
n[j] -= center;
}
}
//System.out.println(i + "," + need + "," + Arrays.toString(n));
int amari = 0;
for(int j=0;j<3;j++) {
amari += n[j] / 2;
}
if (amari >= need) {
left = center;
}else{
right = center;
}
}
System.out.println(left);
}
}
ぴろず