結果

問題 No.73 helloworld
ユーザー itezpaceitezpace
提出日時 2016-09-26 08:31:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,362 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 53,108 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 06:27:36
合計ジャッジ時間 1,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

pair<int,int> calc(int a){
  pair<int,int> p;
  int b=0,bf=0,bs=0;
  for(int i=2;i<=a-1;++i){
    int c=i*(i-1)/2;
    int d=a-i;
    int e=c*d;
    if(b<e) b=e,bf=c,bs=d;
  }
  p.first=bf;
  p.second=bs;
  return p;
}

int main(){
  int ary_in[26];
  for(int i=0;i<26;++i){
    cin>>ary_in[i];
  }
  int ary_word[26];
  for(int i=0;i<26;++i){
    ary_word[i]=0;
  }
  char ca='h'; int a=ca; a-=97; ary_word[a]=1;
  char cb='e'; int b=cb; b-=97; ary_word[b]=1;
  char cc='l'; int c=cc; c-=97; ary_word[c]=3;
  char cd='o'; int d=cd; d-=97; ary_word[d]=2;
  char ce='w'; int e=ce; e-=97; ary_word[e]=1;
  char cf='r'; int f=cf; f-=97; ary_word[f]=1;
  char cg='d'; int g=cg; g-=97; ary_word[g]=1;
  int ary_diff[26];
  for(int i=0;i<26;++i){
    ary_diff[i]=ary_in[i]-ary_word[i];
  }
  ll ans=1;
  for(int i=0;i<26;++i){
    if(ary_diff[i]<0) ans=0;
  }
  if(ans>0){
    int a2=ary_in[a];
    int b2=ary_in[b];
    int c2=ary_in[c];
    pair<int,int> p=calc(c2);
    int c2_1=p.first;
    int c2_2=p.second;
    int d2=ary_in[d];
    int d2_1=d2/2;
    int d2_2=d2-d2_1;
    int e2=ary_in[e];
    int f2=ary_in[f];
    int g2=ary_in[g];
    ans=a2;
    ans*=b2;
    ans*=c2_1;
    ans*=c2_2;
    ans*=d2_1;
    ans*=d2_2;
    ans*=e2;
    ans*=f2;
    ans*=g2;
  }
  cout<<ans<<endl;
  return 0;
}
0