結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー 👑 KazunKazun
提出日時 2022-03-15 04:41:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 3,000 ms
コード長 924 bytes
コンパイル時間 2,540 ms
コンパイル使用メモリ 199,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 12:22:19
合計ジャッジ時間 6,964 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 17 ms
5,376 KB
testcase_02 AC 65 ms
5,376 KB
testcase_03 AC 43 ms
5,376 KB
testcase_04 AC 13 ms
5,376 KB
testcase_05 AC 54 ms
5,376 KB
testcase_06 AC 82 ms
5,376 KB
testcase_07 AC 88 ms
5,376 KB
testcase_08 AC 88 ms
5,376 KB
testcase_09 AC 86 ms
5,376 KB
testcase_10 AC 86 ms
5,376 KB
testcase_11 AC 84 ms
5,376 KB
testcase_12 AC 85 ms
5,376 KB
testcase_13 AC 85 ms
5,376 KB
testcase_14 AC 85 ms
5,376 KB
testcase_15 AC 85 ms
5,376 KB
testcase_16 AC 89 ms
5,376 KB
testcase_17 AC 89 ms
5,376 KB
testcase_18 AC 86 ms
5,376 KB
testcase_19 AC 86 ms
5,376 KB
testcase_20 AC 82 ms
5,376 KB
testcase_21 AC 85 ms
5,376 KB
testcase_22 AC 89 ms
5,376 KB
testcase_23 AC 86 ms
5,376 KB
testcase_24 AC 86 ms
5,376 KB
testcase_25 AC 82 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;

ll to_long_long(string X){
    int n=X.length();
    return stol(X.substr(0,n-3))*100+(X[n-2]-'0')*10+(X[n-1]-'0');
}

bool check(ll V, ll T, ll mu, ll L){return V*(25*V+18*T*mu)<=(ll)6480*mu*L;}

string answer(int V){
    int x=V/100, y=V%100;
    int a=y/10, b=V%10;
    return to_string(x)+"."+to_string(a)+to_string(b);
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string t,m,l;
    ll T,mu,L;
    int D,U,M;

    int N; cin >> N;

    while (N){
        cin >> t >> m >> l;
        T=to_long_long(t);
        mu=to_long_long(m);
        L=to_long_long(l);

        D=0; U=5100*100;
        while (U-D>1){
            M=D+(U-D)/2;
            if (check(M,T,mu,L)){
                D=M;
            }else{
                U=M;
            }
        }

        cout << answer(D) << "\n";

        N--;
    }

    return 0;
}
0