結果

問題 No.338 アンケート機能
ユーザー GrayCoder
提出日時 2018-08-13 16:50:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 166,232 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 08:04:20
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int rnd(double x) {
  double ret;
  ret = round(x * 100000) / 100000;
  return round(ret);
}

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int A, B;
  cin >> A >> B;

  double a, b;
  a = A ? 1 : 0;
  b = B ? 1 : 0;
  int a_, b_;
  while (1) {
    if (A) {
      a_ = rnd(a / (a + b) * 100);
      if (a_ < A) {
        a++;
        continue;
      } else if (a_ > A) {
        b++;
        continue;
      }
      if (B) {
        b_ = rnd(b / (a + b) * 100);
        if (b_ < B) {
          b++;
          continue;
        } else if (b_ > B) {
          a++;
          continue;
        }
      }
    }
    break;
  }
  cout << a + b << endl;
  return 0;
}
0