結果

問題 No.91 赤、緑、青の石
ユーザー YamaKasa
提出日時 2018-07-06 15:47:48
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 77,000 KB
実行使用メモリ 61,184 KB
最終ジャッジ日時 2024-07-01 02:46:22
合計ジャッジ時間 9,413 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other WA * 3 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n[] = new int[3];
		n[0] = scan.nextInt();
		n[1] = scan.nextInt();
		n[2] = scan.nextInt();
		scan.close();
		Arrays.sort(n);
		long cnt = 0;
		cnt += n[0];
		n[1] -= n[0];
		n[2] -= n[0];

		boolean flag = true;
		while(flag) {
			if(n[1] <= 2 && n[2] <= 2) {
				flag = false;
			}else {
				if(n[1] == 0) {
					if(n[2] - 5 >= 0) {
						n[2] -= 5;
						cnt ++;
					}
				}else if(n[2] == 0) {
					if(n[1] - 5 >= 0) {
						n[1] -= 5;
						cnt++;
					}
				}else if(n[1] - 3 >= 0) {
					n[1] -= 3;
					n[2] --;
					cnt ++;
				}else if(n[2] - 3 >= 0) {
					n[1] --;
					n[2] -= 3;
					cnt ++;
				}
			}
		}
		System.out.println(cnt);

	}
}
0