216 - hack random number generator

Back to General discussions forum

mmartinezve     2023-04-20 18:57:57

Hello, I come with a small doubt regarding the exercise that I am trying to solve since there are some test cases that are failing me.

23 3505207047604794384 10980403102822655315 4615180225378014654 7802103462338050327 14533887325688763604 6573470218527913525 11907285249918717436 18035192591230598333 13854529190047606894 6987902062502356719 18087485519024156448 3478246995999054065 7185224497210066139 11597615344125077276 14821440842141704549 4229622124565586916 7821647216651646755 1596930421159370398 1105702657142235167 5965147083981008084 12446403444212331513 3318218508301300954 12382293798570972323 1264480739066044784 16331170523422842635 8023344024804159034 3333335700629839909 case 9 FAIL 5377289489990871225 12383227873696513190 429040568813318747 9913595290993918310 7224759493722956951 15573107620449922136 10732882339375517498 9432922478542840639 1911440479783439452 4488195030476430970 421919454771094567 17567036595952597892 case 13 FAIL 7836606951156723050 3782468063421573049 1718898532160720364 3088947072607868699 15784247007577821336 14312530882477770613 13807160689975223024 8903490389798411567 7982737128973255722 10495443607114590011 9515670045509548794 18291454992427716449 8706201662784472740 15015759432121315051 4700502823862816546 17356316645818169809 1856276610357790010 5831270863909049975 17466677995227734819 18154522783219430586 234324887644092557 18092539770927435136 2423072803034108253 11284105926552445406 1746068865896302927 11389050169945200992 12461172507608181073 14662437071647585117 7749811965217123360 16620185630337130411

Expected answer was:

126884692895445521 13257756619491949450 5079519589668925967 5174535351852910690 1782902699602158582 596728192091519045 9983091176844739214 18020122608379783889 (2394573303974320060 case 9 Fail) 1138813221273444120 9964858416810719657 758291656059963345 (667587224690672017 case 13 Fail) 9120199115113961459 13852224781041364914 3012450076555954641 9404136827144177200 11166061887548333641 16867861093025056408 563366652105523980 12516815198279623507 6792344915226361122 1890869171960437950

Your answer was:

126884692895445521 13257756619491949450 5079519589668925967 5174535351852910690 1782902699602158582 596728192091519045 9983091176844739214 18020122608379783889 (13652114745633998008 case 9 Fail) 1138813221273444120 9964858416810719657 758291656059963345 (176251684851517117 case 13 Fail) 9120199115113961459 13852224781041364914 3012450076555954641 9404136827144177200 11166061887548333641 16867861093025056408 563366652105523980 12516815198279623507 6792344915226361122 1890869171960437950

My problem is that taking into account that I have already solved the equations and this solution works in as many test cases as it is possible that it fails in some other. Could you help me understand what is happening?

gardengnome     2023-04-20 19:09:04
User avatar

I've never used C# myself, so apologies for my ignorance: the numbers can obviously get quite big - do the data types you use allow for such large values and there are no overflow issues? It looks like you are implementing large int calculations via strings yourself - is there not something like BigInteger that you could use to make things easier?

mmartinezve     2023-04-20 20:23:06

hello, the problem is that, i'm using jq for this exercise and this language doesn't have a bigintegers. This is the reason why i'm confused if the problem has a mistake in the algorithm or if i have an error in the implementation of biginteger

Please login and solve 5 problems to be able to post at forum