Cody

# Problem 54. Maximum running product for a string of numbers

Solution 1810086

Submitted on 8 May 2019 by Rajpurohith Urmila
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
s = '123454321'; i_correct = 3; assert(isequal(running_product(s),i_correct))

n = 9 p = 0 m = 344362200 p = 344362200 ind = 1 m = 365445600 p = 365445600 ind = 2 m = 372754512 p = 372754512 ind = 3 m = 365445600 m = 344362200

2   Pass
s = '5820974944592307816406286208998628034825342117067'; i_correct = 28; assert(isequal(running_product(s),i_correct))

n = 49 p = 0 m = 406022400 p = 406022400 ind = 1 m = 421344000 p = 421344000 ind = 2 m = 391248000 m = 446022720 p = 446022720 ind = 4 m = 483191280 p = 483191280 ind = 5 m = 440806080 m = 424776768 m = 465620688 m = 408439200 m = 400584600 m = 369770400 m = 383724000 m = 376992000 m = 369452160 m = 391184640 m = 423783360 m = 369847296 m = 356638464 m = 363916800 m = 377395200 m = 391910400 m = 408240000 m = 362880000 m = 406425600 m = 413683200 m = 436665600 m = 489065472 p = 489065472 ind = 27 m = 550198656 p = 550198656 ind = 28 m = 491248800 m = 482630400 m = 406425600 m = 370137600 m = 356428800 m = 399200256 m = 356428800 m = 393556800 m = 393556800 m = 393556800 m = 351390000 m = 344362200 m = 318372600 m = 343343000 m = 316932000 m = 342286560 m = 384199200

3   Pass
s = '141592653589793238462643383279502884197169399399999'; i_correct = 47; assert(isequal(running_product(s),i_correct))

n = 51 p = 0 m = 377177892 p = 377177892 ind = 1 m = 384875400 p = 384875400 ind = 2 m = 399678300 p = 399678300 ind = 3 m = 432305100 p = 432305100 ind = 4 m = 415991700 m = 386799300 m = 433215216 p = 433215216 ind = 7 m = 457282728 p = 457282728 ind = 8 m = 474538680 p = 474538680 ind = 9 m = 530366760 p = 530366760 ind = 10 m = 510352920 m = 455672250 m = 407706750 m = 415119600 m = 378705600 m = 400982400 m = 400982400 m = 424569600 m = 394243200 m = 386661600 m = 365180400 m = 409002048 m = 386279712 m = 371422800 m = 400554000 m = 447678000 m = 423695250 m = 398772000 m = 398772000 m = 406022400 m = 398899200 m = 391372800 m = 399526400 m = 455460096 m = 447326880 m = 391411020 m = 406465290 m = 472826970 m = 423055710 m = 438439554 m = 510021522 m = 481686993 m = 481686993 m = 538356051 p = 538356051 ind = 44 m = 538356051 m = 538356051 m = 601692057 p = 601692057 ind = 47

4   Pass
s = '7831652712019091456485669234603486104543266482133936072602'; i_correct = 21; assert(isequal(running_product(s),i_correct))

n = 58 p = 0 m = 415633680 p = 415633680 ind = 1 m = 400519728 m = 357606900 m = 385654500 m = 385654500 m = 357087500 m = 323400000 m = 316932000 m = 328456800 m = 321753600 m = 366799104 m = 374440752 m = 397365696 m = 369480384 m = 415665432 p = 415665432 ind = 15 m = 379203552 m = 433375488 p = 433375488 ind = 17 m = 441709632 p = 441709632 ind = 18 m = 450043776 p = 450043776 ind = 19 m = 450043776 m = 493317216 p = 493317216 ind = 21 m = 440461800 m = 423840600 m = 408142800 m = 408142800 m = 343699200 m = 350573184 m = 357447168 m = 384943104 m = 384943104 m = 392962752 m = 369847296 m = 369847296 m = 350034048 m = 337069824 m = 350827776 m = 365445600 m = 379501200 m = 386661600 m = 386661600 m = 424569600 m = 424569600 m = 385257600 m = 363854400 m = 356857200 m = 363229650 m = 370494243 m = 408299778 m = 384282144 m = 414421920 m = 363528000 m = 384912000 m = 342144000 m = 356400000

5   Pass
s = '70066063155881748815209209628292540917153643678925903600113305305488'; i_correct = 44; assert(isequal(running_product(s),i_correct))

n = 68 p = 0 m = 369515520 p = 369515520 ind = 1 m = 322486272 m = 362797056 m = 385471872 p = 385471872 ind = 4 m = 349780032 m = 343302624 m = 379063314 m = 393102696 p = 393102696 ind = 8 m = 431642176 p = 431642176 ind = 9 m = 431642176 m = 447930560 p = 447930560 ind = 11 m = 439479040 m = 439479040 m = 439479040 m = 439479040 m = 423497984 m = 407209600 m = 349036800 m = 355269600 m = 362520000 m = 328320000 m = 374284800 m = 421070400 m = 369360000 m = 413683200 m = 430920000 m = 430920000 m = 399000000 m = 422940000 m = 392730000 m = 377020800 m = 377020800 m = 369480384 m = 383423040 m = 361302480 m = 398938155 m = 356944665 m = 393367590 m = 371911176 m = 387091224 m = 394394832 m = 425327760 m = 441080640 m = 483492240 p = 483492240 ind = 44 m = 474012000 m = 465234000 m = 482151600 m = 413272800 m = 369770400 m = 399352032 m = 361677312 m = 304570368 m = 310915584 m = 298722816 m = 282127104 m = 299760048 m = 299760048 m = 324230256 m = 337464144 m = 317613312 m = 330068736 m = 357574464 m = 377814528 m = 414855168

6   Pass
s = '11111'; i_correct = 1; assert(isequal(running_product(s),i_correct))

n = 5 p = 0 m = 282475249 p = 282475249 ind = 1