# p 大于100000试验

I am getting p1 >50k for 100000 trials which is incorrect, and that's why after printing 1 line of output the code doesn't print anything else.This is the question statement -

Choose a birthday for the next person, uniformly at random between 0 and n−1. Have that person enter the room. If that person shares a birthday with someone else in the room, stop; otherwise repeat. In each experiment, count the number of people that enter the room. Print a table that summarizes the results (the count i, the number of times that exactly i people enter the room, and the fraction of times that i or fewer people enter the room) for each possible value of i from 1 until the fraction reaches (or exceeds) 50%. this is the link for the question

``````    public class Birthday {
public static void main(String[] args) {
int n = Integer.parseInt(args);
int triaLs = Integer.parseInt(args);
boolean[] birthdAy = new boolean[n];
int[] p = new int[n + 2]; // no of times i people enter the room
int[] aVg = new int[n]; // to sum subsequent p[i]
double[] average = new double[n];

for (int i = 0; i < triaLs; i++) {
for (int j = 1; j <= n; j++) {
int c = (int) (Math.random() * (n - 1));
if (!birthdAy[c]) {
birthdAy[c] = true;
continue;
}
else if (birthdAy[c])
p[j]++;
break;
}