結果

問題 No.221 犯罪都市
ユーザー h_nosonh_noson
提出日時 2016-02-26 16:42:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 768 ms / 5,000 ms
コード長 822 bytes
コンパイル時間 1,338 ms
コンパイル使用メモリ 71,792 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 11:39:07
合計ジャッジ時間 14,348 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 692 ms
4,380 KB
testcase_01 AC 731 ms
4,376 KB
testcase_02 AC 689 ms
4,376 KB
testcase_03 AC 693 ms
4,380 KB
testcase_04 AC 689 ms
4,376 KB
testcase_05 AC 710 ms
4,376 KB
testcase_06 AC 766 ms
4,380 KB
testcase_07 AC 690 ms
4,376 KB
testcase_08 AC 742 ms
4,380 KB
testcase_09 AC 768 ms
4,376 KB
testcase_10 AC 706 ms
4,376 KB
testcase_11 AC 758 ms
4,384 KB
testcase_12 AC 762 ms
4,376 KB
testcase_13 AC 735 ms
4,380 KB
testcase_14 AC 763 ms
4,376 KB
testcase_15 AC 760 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
using namespace std;

#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8


typedef long long ll;

int main() {
    int i, n, c, fault;
    uniform_int_distribution<int> person {1,10000};
    uniform_int_distribution<int> arrest {1,100};
    default_random_engine e;
    cin >> n;
    c = fault = 0;
    rep (i,15000000) {
        int p = person(e);
        int a = arrest(e);
        if (p <= n) {
            if (a < 100)
                c++;
        }
        else {
            if (a == 100) {
                c++;
                fault++;
            }
        }
    }
    cout << (double) fault*100/c << endl;
    return 0;
}

0