結果
問題 | No.73 helloworld |
ユーザー |
|
提出日時 | 2020-06-17 15:56:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 2,227 ms |
コンパイル使用メモリ | 199,160 KB |
最終ジャッジ日時 | 2025-01-11 04:59:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); map<char,int>m; for(char c='a';c<='z';++c){ int num; cin>>num; m[c]=num; } string s="helowrd"s; int64_t ans=1; for(auto&&i:s){ if(i=='l'){ if(m.at(i)<3)ans*=0; else{ int64_t mx=0; for(int j=m.at(i)-1,base=m.at(i);j>=2;--j){ mx=max(mx,1L*j*(j-1)/2*(base-j)); } ans*=mx; } } else if(i=='o'){ int num=m.at(i); int oo=(num+1)/2,o=num/2; ans*=oo*o; } else ans*=m.at(i); } cout<<ans<<"\n"s; }