結果
問題 | No.133 カードゲーム |
ユーザー | bun_bun_bskbn |
提出日時 | 2020-05-12 11:57:43 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 755 ms |
コンパイル使用メモリ | 84,372 KB |
実行使用メモリ | 4,352 KB |
最終ジャッジ日時 | 2023-10-11 07:38:06 |
合計ジャッジ時間 | 2,090 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,352 KB |
testcase_04 | AC | 1 ms
4,352 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,352 KB |
testcase_08 | AC | 2 ms
4,352 KB |
testcase_09 | AC | 2 ms
4,352 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 1 ms
4,348 KB |
testcase_13 | AC | 2 ms
4,352 KB |
testcase_14 | AC | 2 ms
4,348 KB |
testcase_15 | AC | 2 ms
4,348 KB |
testcase_16 | AC | 2 ms
4,348 KB |
testcase_17 | AC | 1 ms
4,352 KB |
testcase_18 | AC | 2 ms
4,352 KB |
testcase_19 | AC | 2 ms
4,348 KB |
testcase_20 | AC | 1 ms
4,352 KB |
testcase_21 | AC | 2 ms
4,352 KB |
testcase_22 | AC | 1 ms
4,352 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int f(int)’ 内: main.cpp:15:1: 警告: 制御が非 void 関数の終りに到達しました [-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)); }