結果

問題 No.73 helloworld
ユーザー tonyu0tonyu0
提出日時 2020-03-28 23:58:22
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 28,464 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 18:21:44
合計ジャッジ時間 914 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:3:31: 警告: 関数 ‘scanf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    3 |   for(int i = 0; i < 26; ++i) scanf("%lld", &a[i]);
      |                               ^~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | int main() {
main.c:3:31: 警告: 組み込み関数 ‘scanf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
    3 |   for(int i = 0; i < 26; ++i) scanf("%lld", &a[i]);
      |                               ^~~~~
main.c:3:31: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:21:3: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   21 |   printf("%lld\n", ans);
      |   ^~~~~~
main.c:21:3: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:21:3: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
main.c:21:3: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

int main() {
  long long a[26];
  for(int i = 0; i < 26; ++i) scanf("%lld", &a[i]);

  long long ans = 1;
  ans *= a['h' - 'a'];
  ans *= a['e' - 'a'];
  ans *= a['w' - 'a'];
  ans *= a['d' - 'a'];
  ans *= a['r' - 'a'];

  ans *= a['o' - 'a'] * a['o' - 'a'] / 4;

  long long l = 0;
  for (int i = 2; i < a['l' - 'a']; ++i) {
    long long left = i * (i - 1) / 2;
    long long right = a['l' - 'a'] - i;
    if (left * right > l) l = left * right;
  }
  ans *= l;
  printf("%lld\n", ans);
}
0