結果
問題 |
No.1010 折って重ねて
|
ユーザー |
![]() |
提出日時 | 2020-03-21 12:17:30 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 706 bytes |
コンパイル時間 | 1,326 ms |
コンパイル使用メモリ | 29,440 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 13:11:56 |
合計ジャッジ時間 | 2,893 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
// yuki 1010 折って重ねて // 2020.3.21 bal4u #include <stdio.h> typedef long long ll; ll x, y; int xf, yf; void mi(void) { if (x > y || (x == y && xf && !yf)) { ll t = x; x = y, y = t; int f = xf; xf = yf, yf = f; } } void ma(void) { if (x < y || (x == y && !xf && yf)) { ll t = x; x = y, y = t; int f = xf; xf = yf, yf = f; } } int main() { ll h; int ans; scanf("%lld%lld%lld", &x, &y, &h); x *= 1000, y *= 1000, ans = 0; while (1) { mi(); if (x > h || (x == h && xf)) { if (x & 1) xf = 1; x >>= 1, h <<= 1; ans++; } else break; } ma(); while (x > h || (x == h && xf)) { if (x & 1) xf = 1; x >>= 1, h <<= 1; ans++; } printf("%d\n", ans); return 0; }