Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Treat? Itadakimasu…😋

By gh0st1 · Limits 1s, 512 MB

So the fight against the demonized humans, who eat good humans, is raging on. And the cause for these human demonizations is none other than the Covid virus, created by the “Virus Mommy” Muzan. The demon slayer corps are now hunting Muzan. But at the same time, they have to deal with the demons as well. To kill them the slayers need a special type of Katana (a type of Japanese sword) created by special swordsmiths.

Maya-chan has joined the slayers as an assistant to Haganezuka oji-san, a famous swordsmith. Immediately after joining Maya-chan noticed a problem that almost all the swordsmiths struggle with. And the problem is determining the power level of the katanas. The calculation process of the power level is given below:

The katanas are made by mixing 44 different special types of elements each having a special power level. So after making a katana by mixing all the elements, to get the power level of the katana, first, one has to multiply all the 44 power levels of the elements. Then take the last 22 digits of the product of the 44 power levels.

Now depending on the acquired 22 digit number the power level of the Katana is determined as given below:

  • If the acquired 22 digit number is in the range [00,24][00, 24] (inclusive), Then the Katana power is level 00.

  • If the acquired 22 digit number is in the range [25,49][25, 49] (inclusive), Then the Katana power is level 11.

  • If the acquired 22 digit number is in the range [50,74][50, 74] (inclusive), Then the Katana power is level 22.

  • If the acquired 22 digit number is in the range [75,99][75, 99] (inclusive), Then the Katana power is level 33.

Now Maya-chan wants your help to write a program that can calculate the power level of the katanas and make the lives of the swordsmiths easier. She also informs you that the magic word to solve this problem is “Itadakimasu” (a Japanese word) and the right Breathing Technique. 😉

Oh!!! Almost forgot about the Treat prepared for you to motivate you to do the task. Here it is:

What do you get when you divide a number by 100100 and take the remainder? (Consider large numbers for better understanding)

Not satisfied yet? Well here’s another one.

Once upon a time while doing something a certain someone found out that,

(a×b)%mod=((a%mod)×(b%mod))%mod(a \times b) \% mod = ((a \% mod) \times (b \% mod)) \% mod

Don’t believe it? then,

Calculate (107×222)%100(107 \times 222)\%100 and again calculate ((107%100)×(222%100))%100((107\%100) \times (222 \% 100)) \% 100… Found anything?

What? still don’t like the treat? Well….. Like it or not, it’s a pretty amazing treat. So why don’t you just dig in saying “Itadakimasu” out loud?


44 non-negative integer numbers will be given on a single line separated by spaces. None of the integers will be greater than 109.\textbf{10}^9.


Output contains a single line “level X“ (without quotes), where X is the level of the Katana. See the sample output for details.


2 3 4 8
level 3
1 1 1 1
level 0

In the first test case, after multiplying the numbers we get, 2×3×4×8=1922 \times 3 \times 4 \times 8=192. By taking the last 22 digits of 192192 we get 9292. which is in the range [7599][75-99]. So the power level is 33.



    94% Solution Ratio

    MursaleenEarliest, 1w ago

    gh0st1Fastest, 0.0s

    MursaleenLightest, 131 kB

    mdvirusShortest, 186B


    Login to submit


    All we need to do is to find out a number n, made of the last two digits of multiplication of given ...