結果

問題 No.73 helloworld
ユーザー 👑 obakyanobakyan
提出日時 2019-04-29 09:21:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,029 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 70,984 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 16:10:31
合計ジャッジ時間 1,728 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:8: warning: ‘d’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
      ~~^~~~
main.cpp:27:60: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
                                                          ~~^~~~
main.cpp:27:65: warning: ‘w’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
main.cpp:30:17: warning: ‘e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     L64 ret = d * e * h * r * w;
               ~~^~~
main.cpp:27:28: warning: ‘h’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
                          ~~^~~~
main.cpp:27:49: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
                                               ~~^~~~~
main.cpp:27:38: warning: ‘l’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
                                    ~~^~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#define L64 long long
#define MOD (1000000007LL)

int main(void)
{
  L64 l, o, h, e, w, r, d;
  for(int i = 1; i <= 26; i++){
    L64 a;
    std::cin >> a;
    if(i == 4) { d = a; }
    else if(i == 5) { e = a; }
    else if(i == 8) { h = a; }
    else if(i == 12) { l = a; }
    else if(i == 15) { o = a; }
    else if(i == 18) { r = a; }
    else if(i == 23) { w = a; }
  }
  if(d == 0 || e == 0 || h == 0 || l < 3LL || o < 2LL || r == 0 || w == 0){
    std::cout << 0 << std::endl;
  } else {
    L64 ret = d * e * h * r * w;
    L64 lmax = 1;
    for(L64 i = 0; i <= l - 3LL; i++){
      lmax = std::max(lmax, (i + 2LL) * (i + 1LL) / 2LL * (l - 2LL - i));
    }
    ret *= lmax;
    L64 omax = 1;
    for(L64 i = 0; i <= o - 2LL; i++){
      omax = std::max(omax, (i + 1LL) * (o - 1LL - i));
    }
    ret *= omax;
    std::cout << ret << std::endl;
  }
}
0