結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-05-12 11:57:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 812 ms |
コンパイル使用メモリ | 86,288 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 06:42:21 |
合計ジャッジ時間 | 1,753 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
コンパイルメッセージ
main.cpp: In function 'int f(int)': main.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type] 15 | } | ^
ソースコード
#include <iostream>#include <vector>#include<map>#include<string>#include<algorithm>#include<sstream>#include<cmath>#include<typeinfo>using namespace std;int f(int n) {int a;if (n > 1)return n * f(n - 1);else if (n == 1)return 1;}int main() {int n;cin >> n;int win_num = 0;int count = 0;vector<int> a(n), b(n);for (int i = 0; i < n; i++) {cin >> a[i];}for (int i = 0; i < n; i++) {cin >> b[i];}sort(a.begin(), a.end());do {for (int i = 0; i < n; i++) {if (a[i]>b[i]) {count++;}}if (count > n / 2) {win_num++;}count = 0;} while (next_permutation(a.begin(),a.end()));cout << (double)(win_num) / (double)(f(n));}