結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2016-02-25 15:08:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 753 bytes |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 66,284 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 13:06:35 |
| 合計ジャッジ時間 | 1,113 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%ld", &t[i]);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
int main() {
long t[26];
for(long i = 0; i < 26; ++i) {
scanf("%ld", &t[i]);
}
long H = t['h' - 'a'];
long E = t['e' - 'a'];
long L = t['l' - 'a'];
long O = t['o' - 'a'];
long W = t['w' - 'a'];
long R = t['r' - 'a'];
long D = t['d' - 'a'];
long temp;
long res = 1;
res *= H;
res *= E;
temp = 0;
for(long i = 2; i < L; ++i) {
temp = std::max(temp, (i * (i - 1)) / 2 * (L - i));
}
res *= temp;
temp = 0;
for(long i = 1; i < O; ++i) {
temp = std::max(temp, i * (O - i));
}
res *= temp;
res *= W;
res *= R;
res *= D;
printf("%ld\n", res);
return 0;
}
alpha_virginis