結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー Issei MoriIssei Mori
提出日時 2022-06-17 21:51:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 4,030 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 195,396 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 13:34:59
合計ジャッジ時間 24,236 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define DEBUG_
//#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rrep1(i,x) for(int i=((int)(x));i>0;i--)
#define fore(i,a) for(auto &i:a)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define cauto const auto&
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>

using namespace std;

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < SZ(vec); i++) {
        os << vec[i] << (i + 1 == SZ(vec) ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

#define DUMPOUT cerr

void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int MOD1e97 = 1e9 + 7;

struct pre_main{
    pre_main(){
        cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);
    };
}pre_main;

double t, m, L;

double S(double v) {
    return v*t + (v*v)/(20.0*m);
}

bool isOK(double v) {
    return S(v) <= L;
}

// 汎用的な二分探索のテンプレ
double binary_search() {
    double ng = 100000000; //「index = 0」が条件を満たすこともあるので、初期値は -1
    double ok = 0; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 0.00001) {
        double mid = (ok + ng) / 2.0;

        if (isOK(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    ll N;
    cin >> N;
    rep(n, N) {
        cin >> t >> m >> L;
        cout << 3.6 * binary_search() << endl;
    }

    return 0;
}

0