結果

問題 No.133 カードゲーム
ユーザー Ryuichiro Chiba
提出日時 2018-06-09 14:15:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,635 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 85,412 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 12:34:11
合計ジャッジ時間 1,669 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#if __cplusplus >= 201103
#include <numeric>
#endif
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}
int n;
int a[4];
int b[4];
void init()
{
}
void solve()
{
int awin = 0;
int total = 0;
sort(a, a+n);
do{
sort(b, b+n);
do{
total += 1;
int awin_once = 0;
REP(i, n){
awin_once += (a[i] > b[i] ? 1 : 0);
}
awin += (awin_once > n/2 ? 1 : 0);
}while(next_permutation(b, b+n));
}while(next_permutation(a, a+n));
cout << (double)awin / total << endl;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
REP(i, n) cin >> a[i];
REP(i, n) cin >> b[i];
solve();
return 0;
}
// vim:set foldmethod=marker:
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0