Algorithm


Problem Name: beecrowd | 2172

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2172

Event

 

By Nivaldo Carvalho, UNIPE BR Brazil

Timelimit: 2

Prog and Cackto recently started to play a role-playing game called Fortress. In this game, for player's evolve their level they need to defeat monsters, which gives a value of experience (XP) for player.

The producer of the game, Extreme Games, announced that next week will hold the first XP event of this game in which will increase monsters experience in an X value. As Prog and Cackto are at a very high level at which the monsters have a very high amount of experience points, they are having difficulties in calculating the amount of experience points that the monsters will have during the event. You can help them?

 

Input

 

There will be several test cases. Each test case contains two values: X (0 < X ≤ 3) indicating the increase in value of EXP from monsters and M (10 ≤ M ≤ 232-1) indicating the EXP value of the monster. The entry ends with values X == 0 and M == 0, in which should not be processed.

 

Output

 

For each case, your program should show a value E, value of new Monster EXP.

 

 

 

Input Sample Output Sample

1 544768710

2 538533133

3 38884958

0 0

544768710

1077066266

116654874

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main(void)

{
    unsigned long long int b, c;
    int a;

    while (1)
    {
        scanf("%d %llu", &a, &b);

        if (a==0 && b==0)
            break;

        c=a*b;

        printf("%llu\n", c);
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1 544768710 2 538533133 3 38884958 0 0

Output

x
+
cmd
544768710 1077066266 116654874

#2 Code Example with C++ Programming

Code - C++ Programming


#include <iostream>

int main(){
    int mult, n;
    long total;
    while (std::cin >> mult >> n and mult != 0 and n != 0) {
        total = mult*n;
        std::cout << total << std::endl;
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1 544768710 2 538533133 3 38884958 0 0

Output

x
+
cmd
544768710 1077066266 116654874

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
let [a, b] = lines.shift().split(" ");

while(true){
  if(a == 0 && b == 0){
    break;
  }

  else{
    console.log(`${a * b}`);
  }

  [a, b] = lines.shift().split(" ");
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
1 544768710 2 538533133 3 38884958 0 0

Output

x
+
cmd
544768710 1077066266 116654874
Advertisements

Demonstration


Previous
#2171 Beecrowd Online Judge Solution 2171 Sharing with Fink Solution in C, C++, Java, Js and Python
Next
#2175 Beecrowd Online Judge Solution 2175 What is the Fastest? Solution in C, C++, Java, Js and Python