結果

問題 No.73 helloworld
ユーザー kuuso1kuuso1
提出日時 2014-11-20 23:55:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 1,913 bytes
コンパイル時間 1,132 ms
コンパイル使用メモリ 112,976 KB
実行使用メモリ 25,808 KB
最終ジャッジ日時 2024-06-28 21:53:35
合計ジャッジ時間 1,937 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
プレゼンテーションモードにする

using System;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
//helloworld
//dehllloorw
int[] B=new int[26];
String hh="helloworld";
for(int i=0;i<hh.Length;i++){
B[hh[i]-'a']++;
}
long cnt=1;
for(int i=0;i<26;i++){
if(B[i]==0)continue;
if(B[i]==1){
cnt*=Math.Max(A[i]-B[i]+1,0);
}
if(B[i]>1){
if(i==(int)('l'-'a')){
// nC2*mC1 n+m=restMax
long rest=(long)(A[i]-B[i]);
if(rest<0){
cnt*=0;
break;
}
long lmax=-1;
for(long j=0;j<=rest;j++){
long l=(2+j)*(2+j-1)/2;
l*=(1+rest-j);
//Console.WriteLine(l);
lmax=Math.Max(lmax,l);
}
cnt*=lmax;
}
if(i==(int)('o'-'a')){
// nC1*mC1 n+m=rest+2Max
long rest=(long)(A[i]-B[i]);
if(rest<0){
cnt*=0;
break;
}
long lmax=-1;
for(long j=0;j<=rest;j++){
long l=(1+j);
l*=(1+rest-j);
lmax=Math.Max(lmax,l);
}
cnt*=lmax;
}
}
}
Console.WriteLine(cnt);
}
int[] A;
public Sol(){
A=new int[26];
for(int i=0;i<26;i++){
A[i]=ri();
}
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(){return Console.ReadLine().Split(' ');}
static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0