File tree 2 files changed +69
-0
lines changed
2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < stdio.h>
3
+ using namespace std ;
4
+
5
+
6
+ int main (){
7
+ int cur_day=365 ;
8
+ double ans=1.0 ,a1=1.00 ;
9
+ for (int i=0 ;i<80 ;i++){
10
+ if (i!=0 && i%5 ==0 ){
11
+ cout<<i<<" " ;
12
+ printf (" %.13lf\n " ,1.00 -ans);
13
+
14
+ }
15
+ // cout<<cur_day<<" ";
16
+ ans*=(double )(cur_day/365.00 );
17
+ cur_day--;
18
+ }
19
+ return 0 ;
20
+ }
Original file line number Diff line number Diff line change
1
+ // a room conatains n no of people and
2
+
3
+
4
+ // 1 what is no of peaople required at least to make sure that 100% two people have bday on same date
5
+
6
+ // 366
7
+
8
+ // the probability of two people among group has same probbaility
9
+
10
+
11
+
12
+
13
+ // 1- (365/364);
14
+
15
+
16
+ /* Unsorted Array
17
+ Unlike other Coders No logic at all !
18
+ Find and run
19
+
20
+ */
21
+ #include < bits/stdc++.h>
22
+ using namespace std ;
23
+ void calculateProb (int i)
24
+ {
25
+ double val=1 ;
26
+ for (int j=0 ;j<i;j++)
27
+ {
28
+ val = val*(365 -j)/365 ;
29
+ }
30
+ printf (" %0.12f" ,1 -val);
31
+ }
32
+ int main ()
33
+ {
34
+
35
+ for (int i=5 ;i<=75 ;i+=5 )
36
+ {
37
+ printf (" %d " ,i );
38
+ calculateProb (i);
39
+ cout<<endl;
40
+
41
+ }
42
+
43
+
44
+ }
45
+
46
+ /* Unsorted Array
47
+ signing out all hail !
48
+ may the judge have mercy on your code
49
+ p.s @unsorted array no rights reserved */
You can’t perform that action at this time.
0 commit comments