## 11973 - Sierpinski Carpet

All about problems in Volume 119. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

tann36
New poster
Posts: 1
Joined: Thu Nov 10, 2011 2:04 am

### 11973 - Sierpinski Carpet

My code receives WA. As I've eliminated the possibility of a rounding error, I really cannot see why it's still wrong.

I wrote the solution in many ways, this one being the most foolproof:

Code: Select all

``````#include <stdio.h>
#include <iostream>

using namespace std;

long double d1, d2, p3, p6;
int i1, i2,  m = 1000000;
int cases, depth;

int main()
{
cin >> cases;
p3 = m / 3.0;
p6 = m * 2 / 3.0;
for(int cc = 0; cc < cases; cc++){
cin >> d1 >> d2;
i1 = d1 * m + 0.4;
i2 = d2 * m + 0.4;

for(depth = 0; ; depth++){
if(i1 > p3 && i1 < p6 && i2 > p3 && i2 < p6){
printf("Case %d: %d\n", cc + 1, depth);
break;
}
if(depth >= 200){
printf("Case %d: %d\n", cc + 1, -1);
break;
}

if(i1 < p3 || i1 > p6) i1 *= 3;
i1 %= m;
if(i2 < p3 || i2 > p6) i2 *= 3;
i2 %= m;
}
}
}
``````
Notes:
I tried on my computer all possible inputs. 29 should be the highest the depth can be (ie for 0.991325).

I've heard that sometimes the standard input functions can get doubles wrong. I tried getting the input with getc, but was still WA.

Update: when I used double and the input was 0.3 0.3 then i1 and i2 were 299999. I haven't found an input that would do that with long double yet, though I guess i should look into doing manual input in a again (maybe I made a mistake before).

Update 2: Added +0.4 when converting from double to integer. Had the program go through all possible inputs again (0.000001 - 0.999999), everything seems to have processed correctly. Still, no luck uploading though

dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

### Re: 11973 - Sierpinski Carpet

Here are some random cases.
Input:

Code: Select all

``````1000
0.98514 0.85859
0.44074 0.02696
0.21112 0.49645
0.97246 0.99739
0.77169 0.06593
0.00784 0.82287
0.03109 0.10253
0.93834 0.88097
0.33166 0.76275
0.58120 0.95071
0.02949 0.71446
0.45071 0.48945
0.07339 0.47821
0.75804 0.08307
0.25610 0.61936
0.47795 0.57891
0.60587 0.40476
0.90121 0.08221
0.07960 0.98051
0.04644 0.87367
0.69654 0.85129
0.11734 0.21781
0.09878 0.89115
0.65391 0.05568
0.16992 0.43044
0.30842 0.39863
0.05160 0.36293
0.00466 0.75914
0.00573 0.12500
0.90788 0.76270
0.34162 0.26183
0.66660 0.54935
0.63156 0.94749
0.09153 0.56781
0.60501 0.71116
0.72597 0.30149
0.51930 0.46507
0.51975 0.00684
0.22604 0.61809
0.21205 0.33718
0.89933 0.39596
0.75890 0.52048
0.44314 0.95093
0.23945 0.76356
0.68979 0.61239
0.87423 0.14733
0.69668 0.03141
0.14242 0.70435
0.43568 0.49176
0.36644 0.23395
0.53545 0.20421
0.83281 0.09242
0.26278 0.21827
0.83636 0.35256
0.68974 0.48882
0.88479 0.04842
0.73242 0.75259
0.70352 0.80721
0.73429 0.33908
0.95147 0.10650
0.25383 0.42408
0.61901 0.98922
0.85709 0.11404
0.60580 0.92496
0.15891 0.29278
0.49699 0.97225
0.22819 0.85788
0.07616 0.32980
0.84588 0.49097
0.97979 0.07604
0.28798 0.69914
0.45173 0.02810
0.83531 0.18392
0.52300 0.15526
0.42528 0.73313
0.15721 0.63800
0.62722 0.67911
0.95667 0.93975
0.86471 0.48432
0.94062 0.72600
0.69825 0.18714
0.20855 0.60113
0.09446 0.08996
0.74445 0.44823
0.52427 0.94034
0.63949 0.72424
0.91587 0.81226
0.99618 0.09122
0.41000 0.91470
0.64783 0.68271
0.32071 0.99880
0.67792 0.96857
0.90832 0.11145
0.75929 0.79811
0.52411 0.93655
0.12369 0.69991
0.46457 0.38588
0.47584 0.33224
0.78047 0.55903
0.49937 0.22029
0.10806 0.46827
0.28053 0.30238
0.55713 0.02393
0.10215 0.44023
0.12294 0.13065
0.12946 0.74999
0.71856 0.60717
0.88215 0.97090
0.76901 0.79040
0.72695 0.64144
0.50488 0.45665
0.84253 0.01416
0.50993 0.13297
0.69200 0.31838
0.70219 0.29040
0.75867 0.35489
0.65728 0.97377
0.16122 0.20272
0.80648 0.37793
0.67210 0.26338
0.01337 0.92942
0.70012 0.80156
0.93598 0.89545
0.84937 0.58227
0.38723 0.70500
0.16165 0.73984
0.75400 0.05563
0.18860 0.16770
0.48608 0.26393
0.71786 0.04412
0.39902 0.35180
0.32557 0.64005
0.84278 0.21982
0.76127 0.48680
0.75018 0.64926
0.74220 0.43337
0.23494 0.92707
0.98604 0.60584
0.18811 0.17092
0.03944 0.83541
0.73877 0.73887
0.95802 0.36461
0.53232 0.49277
0.75671 0.14663
0.35427 0.18192
0.69724 0.63809
0.27814 0.75329
0.13663 0.02282
0.67314 0.12092
0.93370 0.89790
0.33128 0.58684
0.67743 0.83943
0.44527 0.56622
0.90066 0.66347
0.66240 0.79691
0.53578 0.10363
0.63176 0.40117
0.05746 0.65732
0.96747 0.16408
0.50953 0.81417
0.61578 0.32175
0.07504 0.20677
0.39311 0.89393
0.17837 0.21168
0.10958 0.06625
0.81661 0.11208
0.95151 0.60438
0.17060 0.49404
0.15751 0.56030
0.35721 0.23479
0.50194 0.98343
0.38460 0.05651
0.71384 0.13370
0.46131 0.60559
0.58328 0.68131
0.00306 0.97084
0.34113 0.19907
0.09300 0.24163
0.61683 0.73425
0.96402 0.27137
0.54697 0.88993
0.49432 0.78064
0.27468 0.49848
0.22231 0.82844
0.06323 0.59572
0.57915 0.74304
0.79956 0.72869
0.86240 0.12728
0.89639 0.67692
0.52175 0.32371
0.45807 0.47967
0.67874 0.68834
0.09349 0.79920
0.69697 0.77174
0.04312 0.71032
0.60025 0.82452
0.60516 0.59009
0.25210 0.09457
0.92302 0.04336
0.80260 0.63793
0.38097 0.14977
0.87847 0.54528
0.83608 0.34405
0.02097 0.90439
0.22810 0.73247
0.21214 0.70625
0.55811 0.68617
0.64889 0.89089
0.82615 0.65160
0.36192 0.50939
0.33391 0.86927
0.62289 0.12569
0.38379 0.10259
0.30947 0.03851
0.67644 0.47033
0.62010 0.11208
0.82088 0.05741
0.40147 0.66209
0.56648 0.65696
0.38943 0.58596
0.29221 0.95810
0.80779 0.76509
0.81950 0.85032
0.50192 0.62021
0.12960 0.64566
0.51493 0.02736
0.31658 0.46351
0.72962 0.30134
0.33985 0.70037
0.17070 0.03909
0.31469 0.01629
0.07371 0.95432
0.77994 0.13557
0.95605 0.63870
0.22466 0.50994
0.63157 0.34548
0.27410 0.68040
0.53072 0.43936
0.05957 0.09360
0.73926 0.19617
0.38705 0.18917
0.81620 0.41772
0.71906 0.70363
0.56752 0.54582
0.74844 0.05892
0.23873 0.73822
0.85607 0.06313
0.36223 0.47596
0.11466 0.79953
0.30947 0.31828
0.82729 0.50285
0.18325 0.94104
0.54393 0.10139
0.19499 0.87749
0.07366 0.60350
0.95620 0.09778
0.51550 0.46072
0.32787 0.93592
0.64527 0.39808
0.62052 0.89540
0.79714 0.55723
0.62036 0.85926
0.49874 0.65321
0.61626 0.14611
0.46440 0.77693
0.27978 0.92574
0.03030 0.29169
0.39308 0.62655
0.50404 0.73775
0.34126 0.75159
0.01289 0.74123
0.36547 0.46098
0.56042 0.69191
0.09000 0.69334
0.58874 0.36921
0.92644 0.71052
0.73330 0.54941
0.20262 0.71033
0.85644 0.39557
0.17250 0.98241
0.07167 0.32084
0.61253 0.61580
0.40587 0.10197
0.83973 0.16913
0.08425 0.90991
0.81466 0.34451
0.96901 0.26066
0.95258 0.18013
0.87348 0.69295
0.06217 0.04258
0.91662 0.62574
0.17515 0.98861
0.69894 0.81345
0.37254 0.54130
0.52371 0.55539
0.03975 0.54504
0.32436 0.59538
0.86087 0.81581
0.14846 0.73023
0.80366 0.86412
0.20863 0.23271
0.65690 0.61833
0.96198 0.34116
0.03412 0.60948
0.81558 0.83546
0.62473 0.25981
0.24842 0.89572
0.87269 0.96340
0.50470 0.11089
0.82980 0.24523
0.95379 0.19193
0.78731 0.86955
0.68536 0.27815
0.17190 0.81171
0.67583 0.83383
0.23006 0.13909
0.92094 0.04799
0.38915 0.88696
0.65996 0.88292
0.88191 0.58679
0.84660 0.63906
0.53479 0.67016
0.63356 0.25855
0.36944 0.40748
0.65272 0.13827
0.49372 0.36276
0.23231 0.60651
0.04819 0.28104
0.25627 0.08120
0.07855 0.22009
0.52270 0.93210
0.98009 0.30861
0.35910 0.44364
0.32657 0.53277
0.28308 0.18258
0.82165 0.37200
0.04216 0.12969
0.55176 0.35644
0.92744 0.67572
0.97751 0.08472
0.44748 0.58016
0.35020 0.47124
0.91580 0.84331
0.92451 0.39839
0.61848 0.17207
0.10417 0.00306
0.47520 0.30471
0.74835 0.24779
0.94408 0.83430
0.18040 0.23844
0.61044 0.22716
0.35685 0.00205
0.52201 0.81612
0.49185 0.07213
0.15685 0.44946
0.02962 0.46936
0.10412 0.60433
0.44765 0.37982
0.77821 0.01992
0.19199 0.53568
0.53875 0.56022
0.86493 0.45969
0.87100 0.01395
0.01177 0.77680
0.01525 0.81508
0.04224 0.19217
0.35775 0.78921
0.60534 0.56262
0.63475 0.87976
0.32922 0.26071
0.73007 0.95513
0.72298 0.52237
0.06571 0.99772
0.01764 0.33415
0.86984 0.00745
0.56767 0.37316
0.99637 0.57211
0.58606 0.59612
0.53644 0.86737
0.84597 0.76135
0.11704 0.71521
0.50443 0.88821
0.45083 0.63831
0.51808 0.10977
0.37048 0.24911
0.20424 0.01082
0.53319 0.26407
0.42531 0.92722
0.42490 0.76243
0.76988 0.60648
0.97964 0.29474
0.86685 0.50107
0.09719 0.13953
0.17042 0.61643
0.54130 0.79715
0.51237 0.01639
0.06812 0.82186
0.46018 0.01680
0.29009 0.51896
0.93159 0.14178
0.15260 0.82409
0.25168 0.29935
0.39009 0.84932
0.77527 0.67700
0.28348 0.81499
0.10973 0.54515
0.04622 0.42664
0.56617 0.14010
0.92005 0.30693
0.10408 0.90011
0.91650 0.46135
0.44674 0.61645
0.79677 0.98462
0.66710 0.90692
0.04870 0.08686
0.91095 0.76221
0.06156 0.36482
0.37766 0.16264
0.00316 0.45166
0.26665 0.15293
0.69808 0.28664
0.71328 0.53991
0.68001 0.90782
0.21475 0.44297
0.34308 0.76359
0.38846 0.31884
0.93529 0.42310
0.57124 0.83520
0.74212 0.73207
0.98245 0.23835
0.16408 0.95434
0.48269 0.05693
0.38309 0.22565
0.67731 0.02387
0.17681 0.38625
0.67289 0.10748
0.64739 0.03841
0.94624 0.54969
0.15618 0.49093
0.41804 0.16099
0.64335 0.49926
0.08588 0.80650
0.64171 0.74217
0.47424 0.65712
0.05899 0.54735
0.50170 0.62021
0.67714 0.22308
0.61225 0.14791
0.17178 0.06023
0.44648 0.45308
0.56056 0.51211
0.71405 0.28289
0.83258 0.37148
0.86241 0.82381
0.98480 0.98876
0.65154 0.28045
0.25047 0.79168
0.53385 0.90094
0.72159 0.89218
0.43954 0.17161
0.79182 0.78058
0.16718 0.10476
0.25267 0.46897
0.69272 0.94295
0.39603 0.58797
0.10009 0.30273
0.58562 0.95660
0.32808 0.97766
0.80147 0.58173
0.57049 0.35401
0.79798 0.94979
0.74147 0.38556
0.45002 0.04845
0.10416 0.27532
0.44693 0.17161
0.11572 0.70722
0.81198 0.23876
0.87125 0.28290
0.38938 0.22817
0.81614 0.56397
0.86670 0.78541
0.74201 0.07975
0.05741 0.61585
0.19758 0.23361
0.75114 0.85888
0.80868 0.93159
0.48067 0.71264
0.92462 0.55015
0.98900 0.93070
0.10231 0.02878
0.73600 0.43593
0.83821 0.21803
0.66446 0.71150
0.93967 0.70946
0.43696 0.05384
0.00277 0.91933
0.99909 0.46718
0.08303 0.74479
0.14192 0.22002
0.24243 0.44413
0.37573 0.05659
0.76923 0.21463
0.92830 0.85640
0.95062 0.69385
0.88615 0.91730
0.35324 0.05294
0.43449 0.78567
0.49717 0.19145
0.06444 0.09895
0.31631 0.43684
0.35618 0.66492
0.13210 0.31909
0.22740 0.51879
0.73881 0.37866
0.98631 0.53284
0.58943 0.98124
0.19587 0.36204
0.38197 0.52219
0.21604 0.28770
0.20500 0.33259
0.54905 0.26572
0.05139 0.72176
0.91322 0.98355
0.24602 0.54857
0.14893 0.14118
0.80610 0.72586
0.20847 0.66863
0.18742 0.10172
0.64390 0.43587
0.13223 0.08976
0.23452 0.79374
0.15578 0.72167
0.24386 0.59392
0.88162 0.70127
0.19739 0.62342
0.05266 0.25014
0.97191 0.90996
0.89351 0.10406
0.81615 0.04865
0.18983 0.30306
0.19244 0.12860
0.96076 0.15945
0.42469 0.40091
0.83678 0.31170
0.40146 0.23212
0.02586 0.96901
0.85420 0.79951
0.55695 0.34516
0.20996 0.26158
0.88501 0.43857
0.68871 0.40735
0.31731 0.10119
0.36877 0.66062
0.70927 0.37435
0.84093 0.18492
0.47705 0.06262
0.38559 0.03337
0.43428 0.43781
0.74951 0.81029
0.20593 0.43458
0.56711 0.31450
0.11401 0.39531
0.74047 0.42132
0.68290 0.67096
0.27305 0.95043
0.52130 0.73143
0.83263 0.12528
0.94943 0.00214
0.54001 0.20140
0.54985 0.82222
0.04837 0.38094
0.41431 0.19042
0.62823 0.43396
0.40777 0.01211
0.44669 0.54126
0.85576 0.61370
0.00901 0.01380
0.59864 0.13329
0.96777 0.91301
0.02696 0.28155
0.17650 0.40434
0.52963 0.54827
0.71393 0.17265
0.53758 0.64258
0.46480 0.25394
0.63488 0.25095
0.44137 0.67669
0.11066 0.21271
0.22482 0.23312
0.77438 0.51843
0.29566 0.67151
0.84883 0.79367
0.09048 0.46819
0.54472 0.44748
0.89255 0.05826
0.46260 0.57169
0.28348 0.06905
0.40523 0.15575
0.96185 0.99741
0.41487 0.94281
0.19376 0.59018
0.26687 0.04975
0.42598 0.79865
0.19529 0.37753
0.05949 0.65080
0.48583 0.96967
0.92686 0.51867
0.15038 0.33466
0.78214 0.01735
0.23913 0.69511
0.43032 0.67469
0.90727 0.86525
0.02101 0.71380
0.87473 0.31250
0.41883 0.14638
0.73656 0.28960
0.33935 0.61259
0.57476 0.00344
0.54449 0.76533
0.57965 0.77005
0.90324 0.60398
0.28617 0.06548
0.56366 0.99363
0.01098 0.43656
0.29519 0.34581
0.18402 0.41363
0.27888 0.72551
0.60283 0.09129
0.56731 0.46341
0.60980 0.47756
0.76716 0.98614
0.76225 0.34636
0.34980 0.27003
0.19888 0.33701
0.27058 0.89430
0.66180 0.77853
0.00753 0.17383
0.16746 0.11150
0.71158 0.57119
0.08052 0.34196
0.91911 0.00677
0.89580 0.26455
0.51936 0.19799
0.66141 0.49863
0.97619 0.08668
0.07282 0.43473
0.78109 0.74335
0.17690 0.83508
0.17209 0.29442
0.35224 0.37578
0.31783 0.44268
0.78003 0.01404
0.28906 0.32536
0.06007 0.11101
0.61649 0.00064
0.00741 0.14060
0.40515 0.53560
0.89711 0.90321
0.56536 0.92451
0.01119 0.55852
0.15677 0.54155
0.44842 0.08402
0.91910 0.93787
0.23229 0.62532
0.16462 0.25471
0.86091 0.74805
0.92561 0.48245
0.97133 0.80446
0.07899 0.21468
0.21532 0.03141
0.17201 0.69548
0.39460 0.38626
0.28947 0.57716
0.66519 0.29172
0.01376 0.85484
0.55991 0.83991
0.08745 0.17054
0.27193 0.17186
0.96070 0.17007
0.42478 0.66774
0.41579 0.12533
0.60778 0.44922
0.41720 0.34140
0.55608 0.74264
0.77405 0.49620
0.35520 0.77141
0.15767 0.94606
0.68674 0.74981
0.20505 0.61066
0.62902 0.35193
0.35536 0.21881
0.55287 0.35246
0.52432 0.44281
0.61288 0.82480
0.49254 0.48502
0.61035 0.20119
0.81393 0.90833
0.41326 0.38166
0.12430 0.23113
0.72733 0.96934
0.90427 0.06187
0.00793 0.08254
0.99587 0.22546
0.99965 0.69467
0.21012 0.36444
0.58325 0.62867
0.14465 0.72901
0.17182 0.29965
0.12445 0.66897
0.31752 0.94823
0.31294 0.61700
0.68885 0.92787
0.47305 0.12687
0.35800 0.10211
0.23498 0.76087
0.82274 0.24886
0.49492 0.13925
0.52824 0.99419
0.85238 0.49079
0.85523 0.52789
0.32008 0.22603
0.95504 0.60200
0.90165 0.46474
0.13371 0.29038
0.23861 0.18963
0.97015 0.61475
0.70615 0.55155
0.67842 0.65900
0.76112 0.17920
0.10360 0.19995
0.44881 0.15962
0.29887 0.08986
0.08406 0.94373
0.59804 0.82711
0.35500 0.93644
0.32599 0.61679
0.38231 0.67509
0.30335 0.28103
0.57142 0.44749
0.63712 0.60058
0.21534 0.97355
0.52511 0.60727
0.42979 0.92149
0.26421 0.36705
0.73052 0.19091
0.35053 0.36781
0.62120 0.17933
0.28658 0.81293
0.80356 0.70526
0.80522 0.04814
0.66493 0.32209
0.16070 0.13122
0.57577 0.21077
0.65826 0.46405
0.06463 0.31071
0.28427 0.45890
0.06617 0.44349
0.36498 0.97290
0.50347 0.49596
0.85040 0.62920
0.16053 0.23400
0.57685 0.36445
0.34090 0.78173
0.65051 0.86344
0.91158 0.14447
0.46656 0.61926
0.91400 0.74004
0.11433 0.79078
0.25483 0.65329
0.96401 0.77259
0.39501 0.48298
0.92648 0.24828
0.38470 0.62470
0.28418 0.29146
0.08418 0.88817
0.12217 0.29810
0.82608 0.40824
0.35349 0.69903
0.72599 0.16698
0.47497 0.00401
0.78679 0.80109
0.70465 0.10505
0.89583 0.86431
0.51760 0.81898
0.75509 0.15066
0.79717 0.48161
0.89341 0.15010
0.93832 0.72365
0.01511 0.27811
0.32981 0.22251
0.52061 0.26282
0.67106 0.61550
0.47805 0.34669
0.67720 0.02455
0.19208 0.20404
0.16866 0.31569
0.42075 0.97887
0.00670 0.87331
0.85582 0.48010
0.79429 0.52431
0.16944 0.61091
0.92454 0.59146
0.31511 0.06286
0.50449 0.86286
0.24889 0.49374
0.75656 0.83430
0.61333 0.76951
0.27972 0.42762
0.45218 0.09138
0.45895 0.12044
0.43614 0.80778
0.78666 0.62761
0.66444 0.02041
0.50051 0.79336
0.48119 0.52026
0.29470 0.29480
0.88626 0.65064
0.87702 0.38276
0.24562 0.36489
0.85864 0.38151
0.37934 0.65804
0.59107 0.61520
0.20635 0.99267
0.24757 0.87079
0.15476 0.82205
0.62983 0.70652
0.49765 0.59090
0.61131 0.58001
0.53690 0.16210
0.68236 0.27534
0.57015 0.01809
0.66873 0.14058
0.52334 0.61993
0.14835 0.54575
0.09079 0.93249
0.59053 0.00699
0.78571 0.63365
0.78984 0.18160
0.21591 0.15558
0.97763 0.03741
0.74394 0.53419
0.12509 0.77099
0.35100 0.24159
0.40369 0.89992
0.17527 0.88790
0.06952 0.24958
0.39016 0.90894
0.69239 0.90177
0.61105 0.07703
0.00952 0.84074
0.01125 0.70184
0.49901 0.76357
0.94517 0.79697
0.95255 0.28885
0.32626 0.32460
0.85880 0.09371
0.02822 0.23372
0.47532 0.14741
0.21086 0.37922
0.43065 0.04253
0.45563 0.54965
0.45859 0.66369
0.56546 0.00932
0.08635 0.31450
0.15525 0.17651
0.04187 0.25939
0.02296 0.16650
0.12699 0.54088
0.82973 0.13165
0.61977 0.24307
0.33678 0.31952
0.55324 0.64209
0.78951 0.36500
0.90774 0.19208
0.39814 0.16389
0.71354 0.50191
0.16560 0.01729
0.02661 0.33565
0.65015 0.89459
0.07110 0.27648
0.53587 0.80540
0.13543 0.27650
0.98090 0.72235
0.85400 0.26242
0.50549 0.81064
0.29368 0.63730
0.27939 0.00579
0.53431 0.84692
0.20253 0.06890
0.39631 0.60558
0.10749 0.60067
0.61796 0.10985
0.44550 0.43662
0.33121 0.80810
0.08458 0.09566
0.90106 0.40231
0.84233 0.78398
0.66985 0.20001
0.46244 0.82324
0.79740 0.68738
0.32468 0.13145
0.13725 0.09108
0.10152 0.60407
0.83650 0.67156
0.44066 0.30405
0.06824 0.23281
0.34267 0.54816
0.98478 0.84973
0.65783 0.95169
0.04735 0.31599
0.88182 0.90593
0.85343 0.11194
0.31195 0.72416
0.71092 0.52329
0.21067 0.77439
0.06937 0.50832
0.76292 0.69887
0.30294 0.20662
0.04170 0.86444
0.33202 0.30296
0.69930 0.48237
0.19405 0.40026
0.24999 0.20549
0.15718 0.34235
0.82186 0.07134
0.97728 0.20454
0.48000 0.70368
0.59136 0.83071
0.35400 0.79195
0.72987 0.46580
0.97412 0.72819
0.42706 0.79924
0.16938 0.73704
0.76501 0.89353
0.36001 0.21108
0.85697 0.09703
0.49729 0.05931
0.26480 0.05102
0.39337 0.91081
0.98215 0.42199
0.79005 0.21523
0.08244 0.12295
0.95367 0.27005
0.22552 0.83732
0.30313 0.47119
0.19939 0.11891
0.91815 0.44077
0.17782 0.78997
0.84702 0.25105
0.46214 0.94283
0.20338 0.20704
0.42987 0.48263
0.53366 0.86419
0.77500 0.69468
0.28019 0.09055
0.46931 0.92068
0.04363 0.23376
0.66733 0.71527
0.55259 0.16082
0.63202 0.89285
0.01177 0.01924
0.46002 0.99493
0.94842 0.09344
0.34450 0.80136
0.90771 0.79545
0.16601 0.97016
0.45279 0.11109
0.97528 0.59588
0.45408 0.14997
0.40405 0.91381
0.83449 0.73427
0.13155 0.87336
0.58863 0.04164
0.20247 0.79888
0.69174 0.30474
0.48751 0.99801
0.99294 0.86703
0.96047 0.94753
0.91241 0.94136
0.90033 0.46849
0.43865 0.82012
0.93121 0.06634
0.66223 0.05497
0.20494 0.90649
0.82030 0.11631
0.01411 0.77251
0.64587 0.81831
0.02348 0.14566
0.94455 0.39802
0.86629 0.22595
0.22396 0.79981
0.66684 0.35380
0.30133 0.38042
0.48530 0.79083
0.25933 0.21374
0.19738 0.38564
0.45198 0.86150
0.07999 0.12859
0.19860 0.11421
0.39405 0.44846``````
Output:

Code: Select all

``````Case 1: 5
Case 2: 24
Case 3: 1
Case 4: 11
Case 5: 4
Case 6: 4
Case 7: 12
Case 8: 12
Case 9: 5
Case 10: 14
Case 11: 7
Case 12: 0
Case 13: 6
Case 14: 6
Case 15: 10
Case 16: 0
Case 17: 0
Case 18: 10
Case 19: 4
Case 20: 18
Case 21: 46
Case 22: 1
Case 23: 11
Case 24: 3
Case 25: 3
Case 26: 8
Case 27: 6
Case 28: 4
Case 29: 5
Case 30: 3
Case 31: 13
Case 32: 0
Case 33: 8
Case 34: 8
Case 35: 2
Case 36: 22
Case 37: 0
Case 38: 15
Case 39: 10
Case 40: 14
Case 41: 6
Case 42: 5
Case 43: 18
Case 44: 3
Case 45: 3
Case 46: 1
Case 47: 4
Case 48: 7
Case 49: 0
Case 50: 7
Case 51: 1
Case 52: 3
Case 53: 14
Case 54: 3
Case 55: 24
Case 56: 41
Case 57: 19
Case 58: 7
Case 59: 4
Case 60: 6
Case 61: 4
Case 62: 5
Case 63: 1
Case 64: 8
Case 65: 2
Case 66: 13
Case 67: 4
Case 68: 6
Case 69: 1
Case 70: 27
Case 71: 12
Case 72: 13
Case 73: 1
Case 74: 1
Case 75: 4
Case 76: 23
Case 77: 24
Case 78: 2
Case 79: 1
Case 80: 2
Case 81: 9
Case 82: 15
Case 83: 3
Case 84: 30
Case 85: 5
Case 86: 13
Case 87: 5
Case 88: 7
Case 89: 20
Case 90: 3
Case 91: 7
Case 92: 9
Case 93: 18
Case 94: 3
Case 95: 5
Case 96: 24
Case 97: 0
Case 98: 7
Case 99: 15
Case 100: 1
Case 101: 11
Case 102: 6
Case 103: 7
Case 104: 11
Case 105: 1
Case 106: 11
Case 107: 2
Case 108: 4
Case 109: 9
Case 110: 8
Case 111: 0
Case 112: 11
Case 113: 1
Case 114: 13
Case 115: 5
Case 116: 3
Case 117: 7
Case 118: 1
Case 119: 12
Case 120: 4
Case 121: 16
Case 122: 6
Case 123: 5
Case 124: 5
Case 125: 2
Case 126: 2
Case 127: 3
Case 128: 1
Case 129: 2
Case 130: 2
Case 131: 0
Case 132: 6
Case 133: 1
Case 134: 4
Case 135: 12
Case 136: 8
Case 137: 8
Case 138: 3
Case 139: 1
Case 140: 2
Case 141: 2
Case 142: 4
Case 143: 0
Case 144: 25
Case 145: 8
Case 146: 8
Case 147: 3
Case 148: 6
Case 149: 5
Case 150: 13
Case 151: 5
Case 152: 8
Case 153: 0
Case 154: 20
Case 155: 4
Case 156: 4
Case 157: 0
Case 158: 7
Case 159: 8
Case 160: 1
Case 161: 17
Case 162: 8
Case 163: 30
Case 164: 1
Case 165: 20
Case 166: 1
Case 167: 2
Case 168: 1
Case 169: 7
Case 170: 3
Case 171: 3
Case 172: 2
Case 173: 5
Case 174: 0
Case 175: 16
Case 176: 13
Case 177: 22
Case 178: 3
Case 179: 2
Case 180: 35
Case 181: 14
Case 182: 1
Case 183: 2
Case 184: 8
Case 185: 2
Case 186: 16
Case 187: 7
Case 188: 1
Case 189: 6
Case 190: 9
Case 191: 0
Case 192: 7
Case 193: 3
Case 194: 4
Case 195: 2
Case 196: 2
Case 197: 0
Case 198: 4
Case 199: 10
Case 200: 9
Case 201: 2
Case 202: 1
Case 203: 7
Case 204: 3
Case 205: 18
Case 206: 5
Case 207: 7
Case 208: 31
Case 209: 16
Case 210: 0
Case 211: 15
Case 212: 5
Case 213: 7
Case 214: 8
Case 215: 7
Case 216: 8
Case 217: 2
Case 218: 0
Case 219: 0
Case 220: 0
Case 221: 2
Case 222: 11
Case 223: 1
Case 224: 0
Case 225: 3
Case 226: 8
Case 227: 3
Case 228: 15
Case 229: 11
Case 230: 2
Case 231: 3
Case 232: 2
Case 233: 1
Case 234: 8
Case 235: 15
Case 236: 0
Case 237: 3
Case 238: 0
Case 239: 3
Case 240: 10
Case 241: 35
Case 242: 5
Case 243: 33
Case 244: 0
Case 245: 8
Case 246: 18
Case 247: 16
Case 248: 0
Case 249: 1
Case 250: 3
Case 251: 1
Case 252: 2
Case 253: 18
Case 254: 1
Case 255: 2
Case 256: 8
Case 257: 0
Case 258: 20
Case 259: 0
Case 260: 19
Case 261: 7
Case 262: 10
Case 263: 0
Case 264: 10
Case 265: 6
Case 266: 16
Case 267: 4
Case 268: 0
Case 269: 2
Case 270: 23
Case 271: 6
Case 272: 0
Case 273: 6
Case 274: 6
Case 275: 0
Case 276: 2
Case 277: 4
Case 278: 4
Case 279: 6
Case 280: 3
Case 281: 12
Case 282: 0
Case 283: 14
Case 284: 1
Case 285: 19
Case 286: 7
Case 287: 5
Case 288: 2
Case 289: 24
Case 290: 2
Case 291: 7
Case 292: 10
Case 293: 17
Case 294: 0
Case 295: 0
Case 296: 5
Case 297: 27
Case 298: 1
Case 299: 2
Case 300: 1
Case 301: 9
Case 302: 0
Case 303: 8
Case 304: 9
Case 305: 1
Case 306: 2
Case 307: 5
Case 308: 11
Case 309: 8
Case 310: 3
Case 311: 13
Case 312: 1
Case 313: 3
Case 314: 1
Case 315: 16
Case 316: 8
Case 317: 33
Case 318: 5
Case 319: 4
Case 320: 4
Case 321: 7
Case 322: 7
Case 323: 7
Case 324: 0
Case 325: 5
Case 326: 0
Case 327: 5
Case 328: 2
Case 329: 7
Case 330: 18
Case 331: 4
Case 332: 24
Case 333: 0
Case 334: 5
Case 335: 2
Case 336: 2
Case 337: 4
Case 338: 0
Case 339: 10
Case 340: 5
Case 341: 0
Case 342: 0
Case 343: 30
Case 344: 10
Case 345: 2
Case 346: 13
Case 347: 9
Case 348: 6
Case 349: 2
Case 350: 7
Case 351: 4
Case 352: 7
Case 353: 1
Case 354: 2
Case 355: 1
Case 356: 8
Case 357: 22
Case 358: 0
Case 359: 29
Case 360: 1
Case 361: 0
Case 362: 1
Case 363: 3
Case 364: 19
Case 365: 7
Case 366: 4
Case 367: 21
Case 368: 0
Case 369: 13
Case 370: 16
Case 371: 2
Case 372: 13
Case 373: 25
Case 374: 17
Case 375: 4
Case 376: 0
Case 377: 10
Case 378: 0
Case 379: 1
Case 380: 25
Case 381: 28
Case 382: 1
Case 383: 0
Case 384: 9
Case 385: 14
Case 386: 5
Case 387: 18
Case 388: 8
Case 389: 3
Case 390: 9
Case 391: 7
Case 392: 1
Case 393: 8
Case 394: 2
Case 395: 1
Case 396: 8
Case 397: 2
Case 398: 3
Case 399: 14
Case 400: 4
Case 401: 1
Case 402: 24
Case 403: 2
Case 404: 5
Case 405: 2
Case 406: 5
Case 407: 47
Case 408: 23
Case 409: 5
Case 410: 7
Case 411: 20
Case 412: 0
Case 413: 3
Case 414: 19
Case 415: 9
Case 416: 3
Case 417: 22
Case 418: 2
Case 419: 12
Case 420: 2
Case 421: 5
Case 422: 11
Case 423: 3
Case 424: 43
Case 425: 5
Case 426: 3
Case 427: 46
Case 428: 3
Case 429: 27
Case 430: 3
Case 431: 2
Case 432: 2
Case 433: 8
Case 434: 10
Case 435: 2
Case 436: 6
Case 437: 12
Case 438: 4
Case 439: 1
Case 440: 19
Case 441: 0
Case 442: 8
Case 443: 10
Case 444: 0
Case 445: 18
Case 446: 0
Case 447: 6
Case 448: 18
Case 449: 2
Case 450: 0
Case 451: 0
Case 452: 2
Case 453: 2
Case 454: 1
Case 455: 17
Case 456: 3
Case 457: 26
Case 458: 7
Case 459: 8
Case 460: 10
Case 461: 1
Case 462: 4
Case 463: 7
Case 464: 16
Case 465: 0
Case 466: 46
Case 467: 4
Case 468: 8
Case 469: 27
Case 470: 0
Case 471: 3
Case 472: 12
Case 473: 16
Case 474: 8
Case 475: 1
Case 476: 6
Case 477: 8
Case 478: 3
Case 479: 4
Case 480: 31
Case 481: 1
Case 482: 12
Case 483: 2
Case 484: 17
Case 485: 14
Case 486: 4
Case 487: 6
Case 488: 8
Case 489: 13
Case 490: 22
Case 491: 7
Case 492: 1
Case 493: 9
Case 494: 2
Case 495: 4
Case 496: 10
Case 497: 6
Case 498: 27
Case 499: 1
Case 500: 19
Case 501: 2
Case 502: 31
Case 503: 60
Case 504: 11
Case 505: 17
Case 506: 3
Case 507: 20
Case 508: 1
Case 509: 9
Case 510: 4
Case 511: 0
Case 512: 3
Case 513: 15
Case 514: 2
Case 515: 3
Case 516: 14
Case 517: 19
Case 518: 0
Case 519: 8
Case 520: 6
Case 521: 4
Case 522: 2
Case 523: 3
Case 524: 9
Case 525: 1
Case 526: 19
Case 527: 5
Case 528: 8
Case 529: 0
Case 530: 3
Case 531: 11
Case 532: 2
Case 533: 16
Case 534: 30
Case 535: 27
Case 536: 6
Case 537: 6
Case 538: 4
Case 539: 2
Case 540: 4
Case 541: 1
Case 542: 2
Case 543: 0
Case 544: 3
Case 545: 5
Case 546: 17
Case 547: 1
Case 548: 0
Case 549: 12
Case 550: 8
Case 551: 8
Case 552: 11
Case 553: 0
Case 554: 2
Case 555: 1
Case 556: 14
Case 557: 21
Case 558: 0
Case 559: 11
Case 560: 7
Case 561: 13
Case 562: 7
Case 563: 7
Case 564: 7
Case 565: 2
Case 566: 23
Case 567: 1
Case 568: 19
Case 569: 1
Case 570: 1
Case 571: 2
Case 572: 4
Case 573: 0
Case 574: 8
Case 575: 0
Case 576: 8
Case 577: 9
Case 578: 5
Case 579: 6
Case 580: 5
Case 581: 2
Case 582: 0
Case 583: 2
Case 584: 0
Case 585: 4
Case 586: 8
Case 587: 11
Case 588: 14
Case 589: 5
Case 590: 14
Case 591: 6
Case 592: 1
Case 593: 3
Case 594: 0
Case 595: 11
Case 596: 0
Case 597: 2
Case 598: 2
Case 599: 7
Case 600: 4
Case 601: 10
Case 602: 2
Case 603: 3
Case 604: 28
Case 605: 3
Case 606: 4
Case 607: 12
Case 608: 19
Case 609: 4
Case 610: 10
Case 611: 20
Case 612: 3
Case 613: 12
Case 614: 3
Case 615: 10
Case 616: 2
Case 617: 0
Case 618: 25
Case 619: 20
Case 620: 6
Case 621: 10
Case 622: 2
Case 623: 4
Case 624: 10
Case 625: 14
Case 626: 7
Case 627: 2
Case 628: 6
Case 629: 0
Case 630: 0
Case 631: 5
Case 632: 3
Case 633: 21
Case 634: 9
Case 635: 10
Case 636: 6
Case 637: 8
Case 638: 1
Case 639: 13
Case 640: 10
Case 641: 4
Case 642: 4
Case 643: 1
Case 644: 0
Case 645: 3
Case 646: 12
Case 647: 26
Case 648: 1
Case 649: 2
Case 650: 0
Case 651: 11
Case 652: 5
Case 653: 4
Case 654: 16
Case 655: 6
Case 656: 4
Case 657: 0
Case 658: 10
Case 659: 5
Case 660: 7
Case 661: 1
Case 662: 16
Case 663: 12
Case 664: 10
Case 665: 4
Case 666: 16
Case 667: 16
Case 668: 17
Case 669: 4
Case 670: 4
Case 671: 16
Case 672: 0
Case 673: 26
Case 674: 16
Case 675: 10
Case 676: 8
Case 677: 3
Case 678: 2
Case 679: 2
Case 680: 12
Case 681: 13
Case 682: 0
Case 683: 0
Case 684: 6
Case 685: 8
Case 686: 9
Case 687: 2
Case 688: 6
Case 689: 3
Case 690: 0
Case 691: 8
Case 692: 0
Case 693: 0
Case 694: 2
Case 695: 0
Case 696: 3
Case 697: 9
Case 698: 0
Case 699: 6
Case 700: 15
Case 701: 16
Case 702: 7
Case 703: 11
Case 704: 21
Case 705: 12
Case 706: 0
Case 707: 6
Case 708: 18
Case 709: 9
Case 710: 3
Case 711: 3
Case 712: 5
Case 713: 1
Case 714: 10
Case 715: 3
Case 716: 24
Case 717: 1
Case 718: 5
Case 719: 1
Case 720: 1
Case 721: 12
Case 722: 2
Case 723: 3
Case 724: 5
Case 725: 9
Case 726: 10
Case 727: 10
Case 728: 6
Case 729: 4
Case 730: 11
Case 731: 1
Case 732: 7
Case 733: 9
Case 734: 2
Case 735: 12
Case 736: 6
Case 737: 13
Case 738: 7
Case 739: 0
Case 740: 0
Case 741: 9
Case 742: 0
Case 743: 25
Case 744: 6
Case 745: 5
Case 746: 0
Case 747: 2
Case 748: 5
Case 749: 7
Case 750: 10
Case 751: 14
Case 752: 1
Case 753: 13
Case 754: 0
Case 755: 7
Case 756: 14
Case 757: 26
Case 758: 28
Case 759: 0
Case 760: 2
Case 761: 11
Case 762: 0
Case 763: 7
Case 764: 7
Case 765: 9
Case 766: 0
Case 767: 14
Case 768: 1
Case 769: 11
Case 770: 17
Case 771: 0
Case 772: 13
Case 773: 0
Case 774: 2
Case 775: 6
Case 776: 22
Case 777: 11
Case 778: 4
Case 779: 2
Case 780: 11
Case 781: 1
Case 782: 18
Case 783: 22
Case 784: 1
Case 785: 5
Case 786: 1
Case 787: 14
Case 788: 2
Case 789: 3
Case 790: 9
Case 791: 6
Case 792: 10
Case 793: 0
Case 794: 13
Case 795: 1
Case 796: 3
Case 797: 3
Case 798: 49
Case 799: 1
Case 800: 1
Case 801: 2
Case 802: 11
Case 803: 8
Case 804: 1
Case 805: 15
Case 806: 3
Case 807: 11
Case 808: 3
Case 809: 4
Case 810: 1
Case 811: 9
Case 812: 6
Case 813: 11
Case 814: 1
Case 815: 0
Case 816: 2
Case 817: 30
Case 818: 12
Case 819: 10
Case 820: 11
Case 821: 0
Case 822: 0
Case 823: 6
Case 824: 7
Case 825: 1
Case 826: 42
Case 827: 0
Case 828: 0
Case 829: 1
Case 830: 3
Case 831: 3
Case 832: 6
Case 833: 0
Case 834: 1
Case 835: 4
Case 836: 9
Case 837: 10
Case 838: 1
Case 839: 1
Case 840: 17
Case 841: 13
Case 842: 5
Case 843: 3
Case 844: 8
Case 845: 1
Case 846: 9
Case 847: 3
Case 848: 12
Case 849: 7
Case 850: 11
Case 851: 16
Case 852: 3
Case 853: 3
Case 854: 2
Case 855: 26
Case 856: 4
Case 857: 6
Case 858: 1
Case 859: 15
Case 860: 5
Case 861: 0
Case 862: 0
Case 863: 7
Case 864: 8
Case 865: 1
Case 866: 2
Case 867: 3
Case 868: 1
Case 869: 1
Case 870: 7
Case 871: 8
Case 872: 0
Case 873: 20
Case 874: 4
Case 875: 2
Case 876: 2
Case 877: 3
Case 878: 5
Case 879: 4
Case 880: 2
Case 881: 1
Case 882: 3
Case 883: 3
Case 884: 20
Case 885: 1
Case 886: 12
Case 887: 4
Case 888: 1
Case 889: 4
Case 890: 0
Case 891: 12
Case 892: 15
Case 893: 0
Case 894: 5
Case 895: 10
Case 896: 20
Case 897: 1
Case 898: 37
Case 899: 1
Case 900: 3
Case 901: 16
Case 902: 8
Case 903: 39
Case 904: 12
Case 905: 9
Case 906: 5
Case 907: 0
Case 908: 12
Case 909: 20
Case 910: 6
Case 911: 4
Case 912: 1
Case 913: 3
Case 914: 4
Case 915: 6
Case 916: 2
Case 917: 7
Case 918: 8
Case 919: 8
Case 920: 10
Case 921: 20
Case 922: 7
Case 923: 9
Case 924: 6
Case 925: 2
Case 926: 3
Case 927: 10
Case 928: 15
Case 929: 3
Case 930: 13
Case 931: 7
Case 932: 3
Case 933: 2
Case 934: 22
Case 935: 7
Case 936: 8
Case 937: 2
Case 938: 2
Case 939: 3
Case 940: 3
Case 941: 1
Case 942: 19
Case 943: 2
Case 944: 6
Case 945: 5
Case 946: 1
Case 947: 17
Case 948: 1
Case 949: 4
Case 950: 3
Case 951: 1
Case 952: 0
Case 953: 1
Case 954: -1
Case 955: 3
Case 956: 7
Case 957: 16
Case 958: 6
Case 959: 1
Case 960: 18
Case 961: 19
Case 962: 12
Case 963: 3
Case 964: 7
Case 965: 3
Case 966: 4
Case 967: 13
Case 968: 23
Case 969: 1
Case 970: 7
Case 971: 2
Case 972: 1
Case 973: 13
Case 974: 1
Case 975: 8
Case 976: 5
Case 977: 17
Case 978: 2
Case 979: 3
Case 980: 6
Case 981: 4
Case 982: 2
Case 983: 4
Case 984: 3
Case 985: 1
Case 986: 8
Case 987: 7
Case 988: 7
Case 989: 2
Case 990: 15
Case 991: 5
Case 992: 13
Case 993: 13
Case 994: 1
Case 995: 8
Case 996: 17
Case 997: 1
Case 998: 4
Case 999: 1
Case 1000: 0``````
Life shouldn't be null.