提出 #2047533
ソースコード 拡げる
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////
double P[10], Q[10];
double f(double a) {
double ans = 1 - a;
rep(i, 0, 6) {
ans += max(0.0, (P[i] + Q[i]) * a - Q[i]);
}
return ans;
}
void solve() {
rep(i, 0, 6) {
int a; cin >> a;
P[i] = a / 100.0;
}
rep(i, 0, 6) {
int a; cin >> a;
Q[i] = a / 100.0;
}
double ans = min(f(0), f(1));
rep(i, 0, 6) {
ans = min(ans, f(Q[i] / (P[i] + Q[i])));
}
cout << ans << "\n";
}
int main() {
#ifndef LOCAL
ios::sync_with_stdio(false);
cin.tie(0);
#endif
cout << fixed;
cout.precision(20);
srand((unsigned int)time(NULL));
#ifdef LOCAL
//freopen("in.txt", "wt", stdout); //for tester
freopen("in.txt", "rt", stdin);
#endif
solve();
#ifdef LOCAL
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
提出情報
提出日時 |
|
問題 |
D - Dice Game |
ユーザ |
omochana2 |
言語 |
C++14 (GCC 5.4.1) |
得点 |
1000 |
コード長 |
2327 Byte |
結果 |
AC |
実行時間 |
1 ms |
メモリ |
256 KB |
ジャッジ結果
セット名 |
Sample |
All |
得点 / 配点 |
0 / 0 |
1000 / 1000 |
結果 |
|
|
セット名 |
テストケース |
Sample |
example0.txt, example1.txt |
All |
000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, example0.txt, example1.txt |
ケース名 |
結果 |
実行時間 |
メモリ |
000.txt |
AC |
1 ms |
256 KB |
001.txt |
AC |
1 ms |
256 KB |
002.txt |
AC |
1 ms |
256 KB |
003.txt |
AC |
1 ms |
256 KB |
004.txt |
AC |
1 ms |
256 KB |
005.txt |
AC |
1 ms |
256 KB |
006.txt |
AC |
1 ms |
256 KB |
007.txt |
AC |
1 ms |
256 KB |
008.txt |
AC |
1 ms |
256 KB |
009.txt |
AC |
1 ms |
256 KB |
010.txt |
AC |
1 ms |
256 KB |
011.txt |
AC |
1 ms |
256 KB |
012.txt |
AC |
1 ms |
256 KB |
013.txt |
AC |
1 ms |
256 KB |
014.txt |
AC |
1 ms |
256 KB |
015.txt |
AC |
1 ms |
256 KB |
016.txt |
AC |
1 ms |
256 KB |
017.txt |
AC |
1 ms |
256 KB |
018.txt |
AC |
1 ms |
256 KB |
019.txt |
AC |
1 ms |
256 KB |
020.txt |
AC |
1 ms |
256 KB |
021.txt |
AC |
1 ms |
256 KB |
022.txt |
AC |
1 ms |
256 KB |
023.txt |
AC |
1 ms |
256 KB |
024.txt |
AC |
1 ms |
256 KB |
025.txt |
AC |
1 ms |
256 KB |
026.txt |
AC |
1 ms |
256 KB |
027.txt |
AC |
1 ms |
256 KB |
028.txt |
AC |
1 ms |
256 KB |
029.txt |
AC |
1 ms |
256 KB |
030.txt |
AC |
1 ms |
256 KB |
031.txt |
AC |
1 ms |
256 KB |
032.txt |
AC |
1 ms |
256 KB |
033.txt |
AC |
1 ms |
256 KB |
034.txt |
AC |
1 ms |
256 KB |
035.txt |
AC |
1 ms |
256 KB |
036.txt |
AC |
1 ms |
256 KB |
037.txt |
AC |
1 ms |
256 KB |
038.txt |
AC |
1 ms |
256 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |