fork download
  1. # your code goes here
  2. def f(n):
  3. count = 0
  4. for i in range(n+1):
  5. for j in range(i+1):
  6. count+=1;
  7. print( n, count, count/n**2 )
  8.  
  9. import random
  10.  
  11. for _ in range(30):
  12. f(random.randrange(1000))
Success #stdin #stdout 0.33s 11892KB
stdin
Standard input is empty
stdout
927 431056 0.5016192866759995
219 24310 0.5068701653426743
252 32131 0.5059681279919375
275 38226 0.5054677685950413
713 255255 0.5021057538913664
555 154846 0.5027059491924357
217 23871 0.5069336787784833
311 48828 0.5048334901417479
921 425503 0.501629843405353
248 31125 0.5060646462018731
605 183921 0.5024820708967966
52 1431 0.529215976331361
458 105570 0.5032798764325623
934 437580 0.5016071420383421
840 354061 0.5017871315192743
770 297606 0.5019497385731152
960 462241 0.5015635850694444
740 274911 0.5020288531775018
942 445096 0.5015934836211521
689 238395 0.5021791747152538
363 66430 0.5041398204433516
578 167910 0.5025981489685228
299 45150 0.5050279079652353
931 434778 0.501612324504679
780 305371 0.5019247205785667
161 13203 0.509355348944871
798 319600 0.5018812695900151
25 351 0.5616
52 1431 0.529215976331361
521 136503 0.5028827627366537