結果

問題 No.73 helloworld
ユーザー リチウムリチウム
提出日時 2014-11-21 00:32:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 1,479 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 73,656 KB
実行使用メモリ 55,852 KB
最終ジャッジ日時 2023-09-11 07:26:31
合計ジャッジ時間 5,253 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
55,324 KB
testcase_01 AC 157 ms
55,728 KB
testcase_02 AC 156 ms
55,652 KB
testcase_03 AC 153 ms
55,572 KB
testcase_04 AC 157 ms
55,828 KB
testcase_05 AC 154 ms
55,852 KB
testcase_06 AC 158 ms
55,784 KB
testcase_07 AC 157 ms
55,560 KB
testcase_08 AC 152 ms
55,780 KB
testcase_09 AC 154 ms
55,332 KB
testcase_10 AC 153 ms
55,620 KB
testcase_11 AC 153 ms
55,732 KB
testcase_12 AC 155 ms
55,628 KB
testcase_13 AC 154 ms
55,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static List<Integer> primes = new ArrayList<Integer>();

	public static long C(int n, int r, long mod) {
		if (n < 0 || r < 0 || r > n)
			return 0;
		if (r > n / 2)
			r = n - r;
		int[] a = new int[n];
		for (int i = 0; i < r; i++)
			a[i] = n - i;

		for (int p : primes) {
			if (p > r)
				break;
			for (long q = p; q <= r; q *= p) {
				int m = (int) (n % q);
				for (int i = m, j = 0; j < r / q; i += q, j++) {
					a[i] /= p;
				}
			}
		}
		long mul = 1;
		for (int i = 0; i < r; i++) {
			mul = mul * a[i] % mod;
		}
		return mul;
	}

	static void primeget(int n) {
		boolean pc;
		primes.add(2);
		primes.add(3);
		for (int i = 4; i < n; i++) {
			pc = false;
			for (int p = 0; p < primes.size(); p++) {
				if (i % primes.get(p) == 0) {
					pc = true;
					break;
				}
			}
			if (pc == false) {
				primes.add(i);
			}
		}
	}
	
  public static void main(String[] args) {
	  primeget(10000);
    Scanner sc=new Scanner(System.in);
    long a[]=new long[26];
    for(int i=0;i<26;i++){
    	a[i]=sc.nextLong();
    }
    long e=a[4];
    long h=a[7];
    long l=a[11];
    long o=a[14];
    long w=a[22];
    long r=a[17];
    long d=a[3];
    long ans=1;
    long x=(l+1)/2;
    ans*=e*h*w*r*d*(o/2)*(o-o/2);
    long max=0;
    for(int i=2;i<l;i++){
    	max=Math.max(C(i,2,Long.MAX_VALUE)*(l-i),max);
    }
    System.out.println(ans*max);
  }
}
0