結果

問題 No.73 helloworld
ユーザー satanicsatanic
提出日時 2016-03-29 23:22:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,494 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 66,348 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 23:56:32
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0