結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2017-07-10 23:48:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 168,408 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 03:49:21 |
合計ジャッジ時間 | 2,298 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n,N) for(int i=(n);i<(int) N;i++) #define p(s) cout<<(s)<<endl using namespace std; int A[4]; int B[4]; int main() { int n; cin>>n; REP(i,0,n) cin>>A[i]; REP(i,0,n) cin>>B[i]; vector<int> vt(n); REP(i,0,n) vt[i]=i; int ok = 0; int cnt = 0; do{ int win = 0; REP(i,0,n) { if (A[vt[i]] > B[i]) win++; else win--; } if (win > 0) ok++; cnt++; } while (next_permutation(vt.begin(), vt.end())); printf("%.3lf",(double)ok/cnt); return 0; }