結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-08-13 04:57:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 843 bytes |
| コンパイル時間 | 446 ms |
| コンパイル使用メモリ | 54,996 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 14:13:59 |
| 合計ジャッジ時間 | 1,021 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:51: warning: ‘d’ may be used uninitialized in this function [-Wmaybe-uninitialized]
27 | ll temp_res = h * e * func_for_o(o) * w * r * d,
| ^
main.cpp:27:45: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized]
27 | ll temp_res = h * e * func_for_o(o) * w * r * d,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
main.cpp:27:41: warning: ‘w’ may be used uninitialized in this function [-Wmaybe-uninitialized]
27 | ll temp_res = h * e * func_for_o(o) * w * r * d,
| ~~~~~~~~~~~~~~~~~~~~~~^~~
main.cpp:11:17: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
11 | ll h, e, l, o, w, r, d;
| ^
main.cpp:30:32: warning: ‘l’ may be used uninitialized in this function [-Wmaybe-uninitialized]
30 | for (ll left_l = 2; left_l <= l - 1; left_l++) {
| ~~~~~~~^~~~~~~~
main.cpp:27:21: warning: ‘e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
27 | ll temp_res = h * e * func_for_o(o) * w * r * d,
| ~~^~~
main.cpp:27:21: warning: ‘h’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ソースコード
#include <iostream>
using namespace std;
typedef long long ll;
ll func_for_o(ll o_cnt) {
return o_cnt / 2 * (o_cnt - o_cnt / 2);
}
int main() {
ll h, e, l, o, w, r, d;
for (int i = 0; i < 26; i++) {
ll c;
cin >> c;
switch ('a' + i) {
case 'h': h = c; break;
case 'e': e = c; break;
case 'l': l = c; break;
case 'o': o = c; break;
case 'w': w = c; break;
case 'r': r = c; break;
case 'd': d = c; break;
default: break;
}
}
ll temp_res = h * e * func_for_o(o) * w * r * d,
res = 0;
// l だけ全探索
for (ll left_l = 2; left_l <= l - 1; left_l++) {
ll l_pattern = left_l * (left_l - 1) / 2 * (l - left_l);
res = max(res, temp_res * l_pattern);
}
cout << res << endl;
return 0;
}
ふーらくたる