結果

問題 No.73 helloworld
ユーザー satanicsatanic
提出日時 2016-03-29 23:20:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,474 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 67,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 05:55:01
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <iomanip>

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
    
    auto Output = [](int i){
        std::cout << i << "\n";
    };
    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