結果

問題 No.398 ハーフパイプ(2)
ユーザー GrenacheGrenache
提出日時 2016-07-15 23:30:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 3,696 bytes
コンパイル時間 3,586 ms
コンパイル使用メモリ 75,560 KB
実行使用メモリ 53,152 KB
最終ジャッジ日時 2023-09-09 22:03:10
合計ジャッジ時間 5,606 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
52,548 KB
testcase_01 AC 63 ms
52,372 KB
testcase_02 AC 79 ms
52,884 KB
testcase_03 AC 71 ms
53,152 KB
testcase_04 AC 78 ms
53,080 KB
testcase_05 AC 77 ms
51,380 KB
testcase_06 AC 64 ms
52,924 KB
testcase_07 AC 65 ms
52,836 KB
testcase_08 AC 63 ms
52,584 KB
testcase_09 AC 64 ms
52,480 KB
testcase_10 AC 64 ms
52,580 KB
testcase_11 AC 77 ms
53,152 KB
testcase_12 AC 77 ms
52,876 KB
testcase_13 AC 65 ms
52,360 KB
testcase_14 AC 78 ms
53,052 KB
testcase_15 AC 64 ms
52,320 KB
testcase_16 AC 64 ms
52,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder398 {

    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	Printer pr = new Printer(System.out);

    	double x = sc.nextDouble();
    	int xx = (int)(x * 4);

    	long ret = 0;
    	for (int i = 0; i <= 100; i++) {
    		for (int j = i; j <= 100; j++) {
    			for (int k = j; k <= 100; k++) {
    				int tmp = xx - i - j - k;
    				if (tmp < k || tmp > 100) {
    					continue;
    				}

    				if (i == j && j == k && k == tmp) {
    					ret += 1;
    					ret += i * 6;
    					ret += (100 - tmp) * 6;
        				ret += i * (100 - tmp) * 6 * 5;
    				} else if (i == j && j == k && k != tmp) {
    					ret += 1 * 6 * 5 / 2; // 6!/4!/2!
    					ret += i * 6 * 5 * 4 / 2; // 6!/3!/2!
    					ret += (100 - tmp) * 6 * 5; // 6!/4!
        				ret += i * (100 - tmp) * 6 * 5 * 4; // 6!/3!
    				} else if (i == j && j != k && k == tmp) {
    					ret += 1 * 6 * 5 * 4 / 3 / 2; //6!/3!/3!
    					ret += i * 6 * 5 * 4 / 2; // 6!/2!/3!
    					ret += (100 - tmp) * 6 * 5 * 4 / 2; // 6!/3!/2!
        				ret += i * (100 - tmp) * 6 * 5 * 4 * 3 / 2; // 6!/2!/2!
    				} else if (i == j && j != k && k != tmp) {
    					ret += 1 * 6 * 5 * 4 / 2; //6!/3!/2!
    					ret += i * 6 * 5 * 4 * 3 / 2; // 6!/2!/2!
    					ret += (100 - tmp) * 6 * 5 * 4; // 6!/3!
        				ret += i * (100 - tmp) * 6 * 5 * 4 * 3; // 6!/2!
    				} else if (i != j && j == k && k == tmp) {
    					ret += 1 * 6 * 5 / 2; //6!/2!/4!
    					ret += i * 6 * 5; // 6!/4!
    					ret += (100 - tmp) * 6 * 5 * 4 / 2; // 6!/2!/3!
        				ret += i * (100 - tmp) * 6 * 5 * 4; // 6!/3!
    				} else if (i != j && j == k && k != tmp) {
    					ret += 1 * 6 * 5 * 4 * 3 / 2 / 2; //6!/2!/2!/2!
    					ret += i * 6 * 5 * 4 * 3 / 2; // 6!/2!/2!
    					ret += (100 - tmp) * 6 * 5 * 4 * 3 / 2; // 6!/2!/2!
        				ret += i * (100 - tmp) * 6 * 5 * 4 * 3; // 6!/2!
    				} else if (i != j && j != k && k == tmp) {
    					ret += 1 * 6 * 5 * 4 / 2; //6!/2!/3!
    					ret += i * 6 * 5 * 4; // 6!/3!
    					ret += (100 - tmp) * 6 * 5 * 4 * 3 / 2; // 6!/2!/2!
        				ret += i * (100 - tmp) * 6 * 5 * 4 * 3; // 6!/2!
    				} else if (i != j && j != k && k != tmp) {
    					ret += 1 * 6 * 5 * 4 * 3 / 2; //6!/2!/2!
    					ret += i * 6 * 5 * 4 * 3; // 6!/2!
    					ret += (100 - tmp) * 6 * 5 * 4 * 3; // 6!/2!
        				ret += i * (100 - tmp) * 6 * 5 * 4 * 3 * 2; // 6!
    				}
    			}
    		}
    	}

    	pr.println(ret);

		sc.close();
        pr.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
//					it = Arrays.asList(br.readLine().split(" ")).iterator();
					it = Arrays.asList(br.readLine().split("\\p{javaWhitespace}+")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

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

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

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

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0