結果

問題 No.73 helloworld
ユーザー kano_townkano_town
提出日時 2014-11-21 10:09:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 4,125 ms
コンパイル使用メモリ 74,128 KB
実行使用メモリ 56,340 KB
最終ジャッジ日時 2023-08-30 22:07:38
合計ジャッジ時間 6,682 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,092 KB
testcase_01 AC 118 ms
56,264 KB
testcase_02 AC 118 ms
56,100 KB
testcase_03 WA -
testcase_04 AC 118 ms
56,080 KB
testcase_05 AC 118 ms
56,088 KB
testcase_06 AC 118 ms
55,968 KB
testcase_07 AC 118 ms
55,512 KB
testcase_08 AC 119 ms
55,732 KB
testcase_09 AC 119 ms
56,340 KB
testcase_10 AC 120 ms
55,764 KB
testcase_11 AC 124 ms
55,940 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.util.Scanner;

public class Yukicoder73 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] alpha = new int[26];
		for (int i = 0; i < 26; i++) {
			alpha[i] = sc.nextInt();
		}
		long maxH = -1, maxO = -1;
		for (int i = 2; i < alpha['l' - 'a']; i++) {
			maxH = Math.max(cmb(i, 2) * (alpha['l' - 'a'] - i), maxH); 
		}
		for (int i = 1; i < alpha['o' - 'a']; i++) {
			maxO = Math.max(i * (alpha['o' - 'a'] - i), maxO); 
		}
		
		System.out.println(maxH * maxO * alpha['h' - 'a'] * alpha['e' - 'a'] * alpha['w' - 'a'] * alpha['r' - 'a'] * alpha['d' - 'a']);

	}

	static long cmb(int n, int m) {
		long c = 1;
		m = (n - m < m ? n - m : m);
		for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
			c *= ns;
			c /= ms;
		}
		return c;
	}
}
0