Exemple #1
0
    static void Main(string[] args)
    {
        Kangaroo kangaroo = new Kangaroo();

        kangaroo.Run();

        CamelCase camelCase = new CamelCase();

        camelCase.Run();

        StrongPassword strongPassword = new StrongPassword();

        strongPassword.Run();

        GradingStudents gradingStudents = new GradingStudents();

        gradingStudents.Run();

        IceCreamParlor iceCreamParlor = new IceCreamParlor();

        iceCreamParlor.Run();

        SockMerchant sockMerchant = new SockMerchant();

        sockMerchant.Run();

        RepeatedStrings repeatedStrings = new RepeatedStrings();

        repeatedStrings.Run();
    }
Exemple #2
0
        public void ShouldFindIceCreams()
        {
            var iceCreams = new int[] { 6, 7, 1, 8, 3, 5, 11 };

            var result = IceCreamParlor.FindChoices(iceCreams, 10);

            Assert.Equal(result, new int[] { 4, 1 });
        }
Exemple #3
0
        public void TestMethod4()
        {
            string expectedResult = "44 657";

            int money = 455070494;

            int[]  cost         = Array.ConvertAll("108174616 35101922 66444877 42195215 33225616 211934783 132764466 186831410 31611758 8417177 11534903 46514261 102390505 97598103 42419576 222050480 77171330 171087720 195518849 167092795 111248806 140691434 159974010 194077132 62900658 135502997 35044070 24531968 70117953 127859720 192783870 187289054 28219064 167207435 190392736 166369798 215518423 190796538 203590567 43766967 9843416 196705566 55846022 227535247 210902162 98693751 58465538 189678557 218820465 45954064 212907938 145490038 107427298 214306628 149754295 150040477 161732494 140059420 76566961 72526746 185249047 32075691 87310939 37292217 62796998 163375622 64325701 135939253 17594725 107914037 66166824 160343384 208253302 128841594 83030524 26892495 181326600 213036035 146294055 69712263 59299676 167028309 215797576 3255338 116741382 152831561 133824374 26950760 86538651 53993295 92325236 83137811 209801698 31939635 202479531 5354776 40470770 50143782 77578878 50018062 219326308 146326050 81688391 14494187 104502977 115222432 52330766 73981684 144965279 25062187 111316157 103163570 183134984 219589371 111040215 37564747 154145984 15642289 173652544 38264023 56494146 192143942 158567148 188217351 28352901 87170203 183368790 97998076 5026252 65313221 97872514 182359065 193971582 109666424 6860462 43124080 138520242 116874464 183557157 196950677 138760037 214608030 14089744 31835888 9919165 171733791 171058046 40248015 78430779 195345259 10127821 197370967 64298307 199371608 175745667 154675022 20531831 155188906 225733116 203883184 167739398 1379817 139954980 98629036 192780780 90530199 115952716 162569529 103567095 30085206 14661802 57225480 177570929 43386061 81728246 12251875 192219889 218260302 8276351 2784324 67166981 69063964 79404113 144585403 133242196 74911526 132362807 142450333 185702338 124476841 4672323 108026078 183049368 17349249 166832703 81616759 103639828 34985119 1750021 119452632 70246335 134370146 91501673 78510941 131876917 178117393 49362051 194041591 226190394 189610927 97919140 169719752 95479423 189560207 27471674 219037078 26366151 1910599 151062691 56313928 39956726 146586754 44041477 179755016 133481855 96906515 49534372 62663421 41211948 43954630 156178337 24976205 185480972 206757254 54943844 71782778 214896063 83395668 144277969 195986886 144768514 132423124 70493098 82639199 71042909 146255707 64470484 47447029 108285505 21793633 172028404 60252036 64981980 148988084 95889230 108560356 193855123 39311454 119470288 196792733 197552294 13342384 91517266 146503237 182764267 188945520 60973083 165391682 187204635 226398164 52025935 209342818 90070019 52290681 151493214 44083471 128481638 66385318 61334966 149915899 4921992 42268011 193879156 116035959 50784463 153168367 219657002 91545277 198786334 13123818 157061225 99489313 198813092 80293149 88811330 41935362 7142853 47408162 115248920 29060531 72026817 124058058 86593598 80284321 74542497 163830377 116655742 148468186 10211843 14892464 84909960 94120045 160822367 13603736 136266686 73331072 178453616 52615579 166610477 92484529 5805626 16187577 221146625 54475442 178282763 90415915 88444452 47458800 218060559 41187522 152317259 167153896 35039124 109467133 125749197 217584205 23490332 39193770 70692787 15965599 108748485 95201627 156043438 58348937 225723105 115933869 60440847 144772074 154514420 145663715 7734559 13415232 6422744 138612449 73850951 131930279 218287653 117877320 60612088 184585106 220534879 184786897 19505336 227054174 96014235 14178542 118242557 125945695 214224714 211771427 96081155 66699145 215807741 163968618 40135469 170647374 69985151 188804668 196833597 133441048 138817399 71102412 2999978 143092789 161452772 39327263 59035696 216943031 7705988 197335566 108457102 35764825 21584188 210779670 164636384 182192646 157482222 185124108 136410439 206218389 81959715 32981589 148762951 24981965 1011521 178496428 197157664 23919828 165575401 150465029 144348552 42851962 193838363 5011990 211876942 103508298 224449556 207382193 15722833 65049593 221300226 134907254 216457658 78211412 27816377 131952374 210464328 55171780 156235035 113440603 67432484 12368454 171663079 54658448 70115212 77708133 134233719 79234031 188975655 91218898 62081461 97046518 135090560 145494005 172767627 202245715 110471086 40472055 33500788 96169120 13792945 147137878 63566971 182379669 171687541 141877142 40161130 181410169 215745690 127009329 97835666 212467699 103285360 52305427 139143555 54535915 70996797 109081387 109742647 164959094 26791493 196807962 73416688 12971424 110497351 212484991 21081208 99863532 64936264 222003794 8670478 189566343 84254098 216925580 46488307 124478062 215509740 73949685 41072641 33033672 7850737 103368354 24576842 38964679 186725381 7072060 98849447 187897984 107992186 122874486 147552838 171112351 79827789 18014965 86136454 118519710 45647727 3639044 52508364 42026926 216341325 202975438 51789258 76609210 24867631 155945254 83395178 183440177 214927496 59864944 136149931 185822489 119492975 132720812 199506517 204686324 129629131 18284031 143519180 135036332 121364362 64093227 169523509 36005886 118649834 44729895 50386482 106691070 7066150 180177405 86628292 102124972 221385617 177010723 9694876 61062751 16692572 222075707 93318175 181805209 130531350 31268182 123320387 58734438 172612575 17725827 9418295 74805574 207960737 158937466 28839412 189211290 26282343 183733184 96926963 173876376 107892524 170210706 64060446 151584931 31369627 75170740 218428030 100494120 115122083 88441726 129424447 211220260 128833042 121281750 171193387 186968212 75957648 160806883 182702004 68498488 33024674 133328831 189313041 52305925 188727795 85353907 192373276 193994916 3753434 168612093 76116782 181791893 189222561 78457306 75188763 216658343 125601793 110463795 122877722 45830442 168498798 55176820 38328732 144179402 203238911 224191620 50347055 39194417 190264468 118916698 155700085 30912764 174345070 80066188 113353522 134401434 111019726 139660378 51306947 162164681 2297900 208689419 200353290 5509606 203743548 120418749 154090593 100462594 156594186 181447994 30576252 105945331 207420238 162046943 150713878 54365603 163897151 206295421 100109534 8040165 197086083 81513684 73156318 119965924 158666118 96211538 215243026 58185751 141123377 47573999 227535247 51847681 5058266 146296326 41039759 205073222 161481408 3719947 226476516 82673047 133068196 156480429 87892982 217733036 215066214 88184258 199093067 191890520 118376095 195878183 189011835 32063336 221985733 85808298 28950129 120653743 96412907 153476624 202711538 9670741 72865355 45739680 71374676 113642344 124895616 80666357 136743339 13946074 69376003 56582651 78712109 96850366 212684962 52930475 3850360 150823888 25732648 77580666 17123878 82130887 19439365 26720090 73251215 227253381 168429953 180812250 82056209 196595666 158141307 208663886 90478560 24555652 188138463 213525961 123589467 138424539 61641326 33033831 55004815 194561771 152425468 60944374 105549852 151455510 38265430 212903565 175355756 169181217 120575506 73329571 35452004 14432743 111451709 185655135 6741848 132287594 45748859 110456755 83889380 213213626 182143235 170217764 9197748 182552814 190922643 117614117 225639798 134189028 45273624 2788657 155417927 76983271 150138101 125540068 103067899 123411123 5921895 106090970 213518476 177454310 222085154 198873229 123475118 34027059 141082019 146994599 192595011 166364333 32469941 29180028 139771738 207127098 167027962 10050036 205937806 160272709 190111672 168248934 157320019 177221700 130833521 12801508 86786894 21071299 78445923 212384783 159591880 93811876 153540258 99642985 132460304 152279803 182221441 138478671 178630101 139293201 30911061 193852471 32224715 70329340 125163436 207701718 190907025 8582507 119657326 52067604 77419458 160499415 187452109 206626923 183792363 67242888 25780109 25262495 129628313 80309751 94603592 156234797 224673397 125917510 160414524 217955912 24890823 46752622 135369532 84964713 60799396 27062616 87993191 213636619 107617021 16744321 217628174 142353303 14175147 28656883 158615956 127803951 178889078 109918724 101266982 117621810 197979078 209913518 29677486 199917584 190270021 200895259 183715047 146833011 3528023 212481764 72949812 10555001 84354378 86496167 96830929 161473404 76543187 156471623 56633928 20804146 123680103 209104268 100031089 16993792 131702254 146798578 179861198 168187777 170928300 61280987 190242369 214964288 2766299 166460686 58664761 149743921 110155954 74475992 6929331 136337728 94510797 182402778 227507738 44176752 3719068 47626599 181488443 62820646 53327928 162317118 227096165 31496757 78243462 213415009 147144116 203084531 222402811 77250327 50308175 3818327 72278294 165819228 44460770 223782764 189606326 77198396 53243326 30850931 21325091 225823989 221204899 162451881 77211741 96248226 173497635 207116579 200769004 50241701 23004179 92383896 171852588 37022997 111813659 2716036 108956670 131550193 208540960 132415274 157938782 119137644 178892908 130826565 182676353 218749825 125892951 75411103 8022152 123725590 63495331 21963379 64467394 74386921 218392638 219463089 185191371 86987827 75781743 53084971 69725222 73045772 117913052 26212686 139336742 91528944 214719562 5511163 194924888 212109116 182639532 94621787 210277468 38260 12437577 170034205 7184890 225696732 192302473 175141872 120577189 157771865 12683278 40898009 172417357 145471651 105599416 45967121 38358611 135952953 48358467 8788731 19937155 111647691 88577107 59777690 168049023 102380525 217263321 44151653 84709136 88204738 137907007 65152142 186480837 167408118 224905100 89415468 108736568 56644132 227436068 198119052 59514947 15425684 187028151 65999778 90423264 164472005 67064107 92296354 94170818 206190264 225087157 40758555 65738568 179392923 181864840 97079240 192207035 176493546 188226432 61149437 79471857 36313910 106372486 61026725 197569366 179355134 50491484 75054297 1183897 76248118 36960025 90335875 123506932 19472360 61594905 175666099 120316797 96703134 192900167 226159845 173436663 35677917 66686627 48116665 111648117 206768735 210717426 44784147 113270352 78312638 51296831 135951477 15396311 136722044 93965281 119976447 64045822 23308355 52513942 138616396 5656542 214157038 53532173 13218282 215620189 181823368 199177898 196065075 105613757 129535699 142384968 62680249 109363434 128732710 215422232 14701070 82115906 10476004 133748175 6170303 25932810 208959779 55443780 102062153 202223201 211078396 6158127 208709182 15841875 135750837 55185336 113474167 195948829 39801273 22772207 200856286 40764157 15954592 99377296 38035820 148373999 225098829 183379135 185500156 97605498 96809206 50088352 197380948 53156425 71757155 50351414 127647464 140693929 166179277 167760305 162875382 86307566 57575273 16670055 192292539 92958640 27160740 171703542 189483371 206656631 200156427 193167613 225029380 140211048 209056666 15599830 60455006 30288154 204346514 30318614 189297337 177209980 78312995 221967980 137173249 31549659 216058225 103136492 156862312 155292874 74474855 207875169 130977370 68786249 162540426 143970440 176863671 2579467 193377266 222506767 130841281 133625596 123562913 12447669 220716201 194877134 109339898 128930628 95555284 197089072 57309471 129608073 6075462 9641842 169297938 64004340 189382683 96700657 71168884 133985733 49739141 41471133 19322247 69391154 125576790 88915632 152094709 33739875 22858229 193014155 163229798 19719863 188021669 112265727 92469400 38967721 215225171 43347802 126353708 222854111 18001038 114342164 127723842 187290484 53819636 87259230 45870040 210764264 172933799 85452379 146282550 160480061 62348705 217293629 68443800 137719176 180584467 135238797 33387613 70866831 17655434 81901901 8247734 69018343 195706473 80200056 51159388 195553334 168734520 218770255 199069626 122002389 224245442 208802388 153586618 63779085 178229274 121384283 148559347 224059329 184014934 95005990 56700149 185039505 105101187 109587792 45562678 163846644 172303702 218737168 180377395 147348745 99581832 174651404 164629876 144114312 170938072 109296576 38595518 120109300 208358055 129695471 112428773 92772308 199299081 33233465 88032584 61281804 16279380 89165937 152352233 17339467 190626041 98808005 74878336 85968572 7991980 108002758 108516271 114599061 180381599 187125930 159010387 173552915 205747435 197518958 46563941 87401787 53194684 221569378 225178853 44952700 250598 77722223 101237851 183898776 31565106 7442052 182898965 135226923 84245646 177178536 220665803 132681925 86471948 17713756 35843888 190444462 139649713 38999541 28806111 85858948 61269997 143625297 65262621 110544657 54761863 155277281 126148461 206273884 224049180 47032989 121049076 21446896 96992536 21367450 23419080 66169487 84208276 170133181 73377259 210838193 55326094 134290842 161227539 223407787 215106815 1489247 5741884 48162590 190460583 66570218 49945220 210183064 90780955 58908741 186920384 18584210 88485917 65705818 116894309 51940545 39180747 52090110 131910439 112707868 105201913".Split(' '), costTemp => Convert.ToInt32(costTemp));
            string actualResult = IceCreamParlor.whatFlavorsCalculate(cost, money);

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #4
0
        public void TestMethod3()
        {
            string expectedResult = "1 3";

            int money = 12;

            int[] cost = new int[] { 7, 2, 5, 4, 11 };

            string actualResult = IceCreamParlor.whatFlavorsCalculate(cost, money);

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #5
0
        public void TestMethod2()
        {
            string expectedResult = "2 4";

            int money = 8;

            int[] cost = new int[] { 4, 3, 2, 5, 7 };

            string actualResult = IceCreamParlor.whatFlavorsCalculate(cost, money);

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #6
0
        public void TestMethod0()
        {
            string expectedResult = "1 2";

            int money = 4;

            int[] cost = new int[] { 2, 2, 4, 3 };

            string actualResult = IceCreamParlor.whatFlavorsCalculate(cost, money);

            Assert.AreEqual(expectedResult, actualResult);
        }
        private static void DoTest(StreamReader sr)
        {
            int t = Convert.ToInt32(sr.ReadLine());

            for (int tItr = 0; tItr < t; tItr++)
            {
                int      money = Convert.ToInt32(sr.ReadLine());
                int      n     = Convert.ToInt32(sr.ReadLine());
                string   line  = sr.ReadLine().Trim();
                string[] lines = line.Split(' ');
                int[]    cost  = Array.ConvertAll(lines, costTemp => Convert.ToInt32(costTemp));

                //IceCreamParlor.whatFlavors(cost, money);
                IceCreamParlor.whatFlavors(cost, money);
            }
        }
Exemple #8
0
        public void TestMethodTC13()
        {
            var input  = System.IO.File.ReadAllText(@"C:\Temp\input13.txt").Split('\n');
            var output = System.IO.File.ReadAllText(@"C:\Temp\output13.txt").Split('\n');

            int t           = Convert.ToInt32(input[0]);
            int resultCount = 0;

            for (int i = 1; i < t; i += 3)
            {
                int    money       = Convert.ToInt32(input[i]);
                string inputString = input[i + 2];

                int[]  cost         = Array.ConvertAll(inputString.Split(' ', StringSplitOptions.RemoveEmptyEntries), costTemp => Convert.ToInt32(costTemp));
                string actualResult = IceCreamParlor.whatFlavorsCalculate(cost, money);
                Assert.AreEqual(output[resultCount].Trim(), actualResult);
                resultCount++;
            }
        }
        public void IceCreamParlorTest(int[] cost, int money, string expected)
        {
            var res = IceCreamParlor.whatFlavors2(cost, money);

            Assert.AreEqual(res, expected);
        }
Exemple #10
0
 static void whatFlavors(int[] cost, int money)
 {
     var(i, j) = IceCreamParlor.GetTwoFlavors(cost, money);
     Console.WriteLine($"{i+1} {j+1}");
 }
Exemple #11
0
 public void FindPairsTests(int[] costs, int money, int i, int j)
 {
     var(x, y) = IceCreamParlor.GetTwoFlavors(costs, money);
     Assert.Equal(i, x);
     Assert.Equal(j, y);
 }
Exemple #12
0
        public void Should_return_the_indices_of_the_bought_flavors(int money, int[] iceCreamFlavors, string expected)
        {
            var iceCreamParlor = new IceCreamParlor(money, iceCreamFlavors);

            Assert.Equal(expected, iceCreamParlor.GetFlavors());
        }