結果

問題 No.338 アンケート機能
ユーザー mio_hmio_h
提出日時 2016-01-29 23:34:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,288 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 73,352 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 17:31:04
合計ジャッジ時間 1,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int a, b;
int x, y;
bool aaa(){
    double e = (double) x;
    double f = (double) y;
    double k = 100 * e/(e + f);
    double c = (double) a;
    if(c - 0.5 <= k && k < c + 0.5) return true;
    return false;
}
bool bbb(){
    double e = (double) x;
    double f = (double) y;
    double k = 100 * f/(e + f);
    double c = (double) b;
    if(c - 0.5 <= k && k < c + 0.5) return true;
    return false;
}
int main(){
    cin >> a >> b;
    if(a > b) swap(a, b);
    x = a, y = b;
    int ans = INF;
    for(int i = 1; i <= a; i++){
        x = i;
        y = (b / a) * i;
        y += 20;
        while(1){
            y--;
            if(y == x) break;
            if(aaa() && bbb()) break;
        }
        if(aaa() && bbb()){
            while(1){
                y--;
                if(!(aaa() && bbb())){
                    y++;
                    break;
                }
            }
            ans = min(x + y, ans);
        }
    }
    cout << ans << endl;
    return 0;
}
0