結果
問題 | No.73 helloworld |
ユーザー |
![]() |
提出日時 | 2017-07-27 12:51:22 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 621 bytes |
コンパイル時間 | 1,458 ms |
コンパイル使用メモリ | 158,636 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 01:49:38 |
合計ジャッジ時間 | 1,960 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 7 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",&count[i]); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>int combi(int n, int r){long long p = 1;for(int i = 1;i <= r;i++) p = p*(n-i+1)/i;return p;}main(){int count[26];for(int i = 0;i < 26;i++){scanf("%d",&count[i]);}int max = 0;for(int i = 2;i < count['l'-'a'];i++){max = std::max(max,combi(i,2)*(count['l'-'a']-i));}long long sum = 1;sum *= count['h'-'a'];sum *= count['e'-'a'];sum *= max;sum *= (count['o'-'a']/2)*(count['o'-'a']/2+count['o'-'a']%2);sum *= count['w'-'a'];sum *= count['r'-'a'];sum *= count['d'-'a'];printf("%lld\n",sum);}