結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-29 23:22:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,494 bytes |
| コンパイル時間 | 512 ms |
| コンパイル使用メモリ | 67,292 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 13:14:04 |
| 合計ジャッジ時間 | 1,057 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <iostream>
#include <cmath>
#include <iomanip>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
auto Output = [](long long int i){
std::cout << i << "\n";
};
long long int helloworldNum = 1;
for(int i=0; i<26; ++i){
int input;
std::cin >> input;
switch(i){
case 3:
case 4:
case 7:
case 17:
case 22:
if(input == 0){
Output(0);
return 0;
}else{
helloworldNum *= input;
}
break;
case 11:
if(input < 3){
Output(0);
return 0;
}else{
double x=input, diff, d=0.001;
do{ //newton
diff = (3*x*x-2*(input-2)*x-input+1)/2.0/(-3*x+input-2);
x += diff;
}while(std::fabs(diff)>d);
double tmp = std::round(x);
helloworldNum *= tmp*(tmp+1)*(input-tmp-1)/2;
}
break;
case 14:
if(input < 2){
Output(0);
return 0;
}else{
helloworldNum *= std::floor(input/2.0)*std::ceil(input/2.0);
}
break;
}
}
Output(helloworldNum);
return 0;
}