結果
問題 |
No.1010 折って重ねて
|
ユーザー |
![]() |
提出日時 | 2020-03-24 23:06:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,202 bytes |
コンパイル時間 | 954 ms |
コンパイル使用メモリ | 90,204 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-01 18:50:54 |
合計ジャッジ時間 | 2,176 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include<algorithm> #include<cmath> #include<cstdio> #include<functional> #include<iomanip> #include<iostream> #include<map> #include<numeric> #include<queue> #include<set> #include<string> #include<utility> #include<vector> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll MOD = 1000000007; #define rep(i,n) for(int i=0;i<n;i++) #define repl(i,s,e) for(int i=s;i<e;i++) #define reple(i,s,e) for(int i=s;i<=e;i++) #define revrep(i,n) for(int i=n-1;i>=0;i--) #define all(x) (x).begin(),(x).end() template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int main() { double x, y, h; cin >> x >> y >> h; //単位調整 x *= 1000; y *= 1000; ll count = 0; while (x > h || y > h) { if (x < y) { if (x > h) { x /= 2; h *= 2; count++; } else if (y > h) { y /= 2; h *= 2; count++; } } else { if (y > h) { y /= 2; h *= 2; count++; } else if (x > h) { x /= 2; h *= 2; count++; } } } cout << count << endl; return 0; }