Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- using namespace std;
- int main() {
- random_device rd;
- mt19937 gen(rd());
- uniform_int_distribution<int> id(0, 3);
- for (int n = 10; n < 51; n++) {
- int cnt = 0;
- for (int i = 0; i < 1000000; i++) {
- int arr[4]{};
- for (int j = 0; j < n; j++) {
- arr[id(gen)]++;
- }
- if (arr[0] >= 2 && arr[1] >= 2 && arr[2] >= 3 && arr[3] >= 3) cnt++;
- }
- printf("%d개 %.3f%\n", n, (double) cnt / 10000);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement