結果
問題 |
No.338 アンケート機能
|
ユーザー |
|
提出日時 | 2016-01-29 23:33:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,288 bytes |
コンパイル時間 | 648 ms |
コンパイル使用メモリ | 72,992 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 18:45:23 |
合計ジャッジ時間 | 1,476 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 11 |
ソースコード
#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 += 10; 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; }