結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー Soham ChaudhuriSoham Chaudhuri
提出日時 2022-06-17 22:06:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,429 bytes
コンパイル時間 3,636 ms
コンパイル使用メモリ 235,856 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 14:02:05
合計ジャッジ時間 15,724 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 61 ms
5,376 KB
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 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3,unroll-loops")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;

#define ll               long long int
#define loop(a,b,i)      for(long long int i=a;i<b;i++)
#define loopr(a,b,i)     for(long long int i=a;i>=b;i--)
#define cn               continue;
#define pb               push_back
#define db               double
#define mp               make_pair
#define sz(x)            (ll)((x).size())
#define endl             "\n"
#define lb               lower_bound
#define ub               upper_bound
#define f                first
#define se               second
#define vll              vector<ll>
#define pll              pair<ll,ll>
#define vpll             vector< pair<ll,ll> >
#define all(x)           x.begin(),x.end()
#define print(a,n)       for(ll i=0; i<n; i++) cout<<a[i]<<" "; cout<<endl;
#define pi               3.14159265358979323846
#define quick            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update > pbds;

const ll inf = 1e18;
const ll mod = 998244353;
const ll MAX = 8000000000000000064LL;
const ll MIN = -8000000000000000064LL;
ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}
ll gcd(ll a,ll b) {if(b==0)return a; return gcd(b,a%b);}
ll lcm(ll x, ll y) { ll res = x / gcd(x, y); return (res * y);}
// ll nCr(ll n,ll r){ll ans=fact[n]; ans*=mod_inv(fact[n-r]);ans%=mod; ans*=mod_inv(fact[r]);ans%=mod; return ans;}
 
const ll dx[] = {-1,1,0,0,1,1,-1,-1};
const ll dy[] = {0,0,1,-1,-1,1,-1,1};

signed main() 
{ quick; 
// #ifndef ONLINE_JUDGE
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);   
// #endif 

    ll tc = 1;
    cin >> tc;
    loop(0,tc,Q)
    {       
        // cout << "Case #" << Q+1 << ": ";
        db t, f, d; cin >> t >> f >> d;
        db a = 1.0;
        db b = (20.0 * f * t);
        db c = -(20.0 * f * d);
        db res1 = (-b + (db)(sqrt(b*b - 4.0*a*c))) / 2.0; 
        db res2 = (-b - (db)(sqrt(b*b - 4.0*a*c))) / 2.0; 
        res1 *= (18.0 / 5.0);
        res2 *= (18.0 / 5.0);
        string ans1 = to_string(res1), ans2 = to_string(res2);
        // cout << ans1 << " " << ans2 << endl;
        if(res1 >= 0.0) {
            string res;
            loop(0, 6, i) {
                res += ans1.back();
                ans1.pop_back();
            }
            loop(0, 2, i) {
                ans1 += res.back();
                res.pop_back();
            }
            cout << ans1 << endl;
        }
        else {
            string res;
            loop(0, 6, i) {
                res += ans2.back();
                ans2.pop_back();
            }
            loop(0, 2, i) {
                ans2 += res.back();
                res.pop_back();
            }
            cout << ans2 << endl;
        }
    }
        
 
// cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
return 0;
}
0