結果

問題 No.338 アンケート機能
ユーザー cympfhcympfh
提出日時 2016-02-14 13:29:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 823 bytes
コンパイル時間 1,168 ms
コンパイル使用メモリ 146,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 21:39:03
合計ジャッジ時間 19,008 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 519 ms
4,380 KB
testcase_01 AC 519 ms
4,376 KB
testcase_02 AC 518 ms
4,376 KB
testcase_03 AC 518 ms
4,376 KB
testcase_04 AC 519 ms
4,376 KB
testcase_05 AC 521 ms
4,380 KB
testcase_06 AC 519 ms
4,380 KB
testcase_07 AC 519 ms
4,376 KB
testcase_08 AC 520 ms
4,380 KB
testcase_09 AC 519 ms
4,380 KB
testcase_10 AC 520 ms
4,376 KB
testcase_11 AC 519 ms
4,376 KB
testcase_12 AC 519 ms
4,380 KB
testcase_13 AC 519 ms
4,376 KB
testcase_14 AC 520 ms
4,380 KB
testcase_15 AC 519 ms
4,376 KB
testcase_16 AC 518 ms
4,376 KB
testcase_17 AC 519 ms
4,376 KB
testcase_18 AC 518 ms
4,376 KB
testcase_19 AC 519 ms
4,380 KB
testcase_20 AC 518 ms
4,376 KB
testcase_21 AC 520 ms
4,376 KB
testcase_22 AC 520 ms
4,376 KB
testcase_23 AC 519 ms
4,380 KB
testcase_24 AC 519 ms
4,376 KB
testcase_25 AC 519 ms
4,376 KB
testcase_26 AC 519 ms
4,376 KB
testcase_27 AC 519 ms
4,380 KB
testcase_28 AC 517 ms
4,376 KB
testcase_29 AC 520 ms
4,376 KB
testcase_30 AC 519 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
using Integer = unsigned long long;

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<typename Nat=int>
pair<Nat, Nat> n2nn(Nat a) {
  int i = 0;
  while (a > i) {
    ++i; 
    a -= i;
  }
  return make_pair(a, i-a);
}

int rat(int a, int b) {
  double r = 100.0 * a / (a+b);
  return int(round(r));
}

int main() {

  int ans = 1e9;
  int A, B; cin >> A >> B;
  int a, b;
  rep (i, 1000000) {
    if (i == 0) continue;
    tie(a,b) = n2nn(i);
    if (rat(a,b) != A) continue;
    if (rat(b,a) != B) continue;
    ans = min(ans, a+b);
  }
  cout << ans << endl;

  return 0;
}
0