結果

問題 No.456 Millions of Submits!
ユーザー ytftytft
提出日時 2021-04-02 01:07:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,775 ms / 4,500 ms
コード長 803 bytes
コンパイル時間 1,405 ms
コンパイル使用メモリ 164,584 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 08:08:33
合計ジャッジ時間 14,577 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 5 ms
6,940 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 38 ms
6,944 KB
testcase_10 AC 39 ms
6,944 KB
testcase_11 AC 376 ms
6,940 KB
testcase_12 AC 3,775 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:31:19: warning: 'middle' may be used uninitialized [-Wmaybe-uninitialized]
   31 |         middle=pow(middle,b/a);
      |                ~~~^~~~~~~~~~~~
main.cpp:9:24: note: 'middle' was declared here
    9 |     double upper,lower,middle;
      |                        ^~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int m;
    cin>>m;
    double a,b,t;
    double e=exp(1);
    double ipsilon=pow(10,-10);
    double upper,lower,middle;
    for(int i=0;i<m;++i){
        cin>>a>>b>>t;
        if(b==0){
            middle=pow(t,1.0/a);
            goto travel;
        }
        if(a==0){
            middle=pow(e,pow(t,1.0/b));
            goto travel;
        }
        t=a/b*pow(t,1.0/b);
        upper=max(t,e);
        lower=1;
        while(upper-lower>ipsilon){
            middle=(upper+lower)/2.0;
            if(middle*log(middle)<t){
                lower=middle;
            }else{
                upper=middle;
            }
        }
        middle=pow(middle,b/a);
        travel:{}
        printf("%.10f",middle);
        cout<<endl;
    }
}
0