結果
問題 | No.1980 [Cherry 4th Tune D] 停止距離 |
ユーザー |
![]() |
提出日時 | 2022-06-17 22:40:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 571 ms / 3,000 ms |
コード長 | 1,659 bytes |
コンパイル時間 | 4,372 ms |
コンパイル使用メモリ | 253,656 KB |
最終ジャッジ日時 | 2025-01-29 22:25:22 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; typedef int64_t lint; #define rep(i, n) for(int i=0; i<n; i++) #define repx(i, l, n) for(int i=l; i<n; i++) #define all(v) v.begin(), v.end() #define show(x) cout << #x << ": " << x << endl; #define list(x) cout << #x << ": " << x << " "; #define pb push_back using vi = vector<lint>; using vvi = vector<vector<lint>>; template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T> inline void drop(T x) { cout << x << endl; exit(0); } template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; } constexpr lint LINF = LLONG_MAX/2; int main() { lint T; cin >> T; rep(_, T) { string a, b, c; lint x, y, z; cin >> a >> b >> c; x = stoi(a.substr(0, a.size()-3))*100+stoi(a.substr(a.size()-2, 2)); y = stoi(b.substr(0, b.size()-3))*100+stoi(b.substr(b.size()-2, 2)); z = stoi(c.substr(0, c.size()-3))*100+stoi(c.substr(c.size()-2, 2)); lint ok = 0, mid, ng = 10010010; while (ng-ok > 1) { mid = (ok+ng)/2; if (mid*x*y*36 + mid*mid*5 <= z*10*y*360*36) ok = mid; else ng = mid; // list(mid) // list(mid*x*y*36 + mid*mid*5) // list(z*10*y*360*36) // list(ng) // show(ok) } string s = to_string(ok/10); if (s.size() == 1) s = '0'+s; if (s.size() == 2) s = '0'+s; std::cout << s.substr(0, s.size()-2) << '.' << s.substr(s.size()-2, 2) << '\n'; } }