ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Фёдор Меньшиков. Тренировки > задача:


040. 50335 - Five Math Operators

Гость
• Вопросы к жюри (1)

Задачи сборника

• 025- 2013-Nov-01. 50328 - How far ...
• 026. 50399 - Mobile Base Station
• 026. 50487 - Radius of Inscribed Circle
• 027. Albanian Airlines
• 028. 50483 - Group Total
• 030. 50584 - Pagesa totale
• 033. 50588 - Perpunimi i nje liste n...
• 035. 50573 - Numri dhe shuma
• 040. 50335 - Five Math Operators
• 044. 50597 - Vizatojme Diamante
• 045. 50462 - Class Average (3 Gra...
• 050. 50450 - Last Appereance of a ...
• 058. 50574 - Numrat Trekendesh
• 060. 50362 - Pythagorean Numbers
• 060. s
• 065. 50394 - Water Bills
• 070. 50465 - How many students h...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 4000/7000/7000/7000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

Five Math Operators

  Write a program that gets two integers and an operator from the keyboard and then does described operation using the given numbers.

  There are five operations:

  • '+' Addition: adds the second number to the first number
  • '-' Subtraction: Subtracts the second number from the first number
  • '*' Multiplication: Multiplies the first and the second numbers
  • '/' Integer division: Divides the first number by the second number producing integer result
  • '%' Modulus: Gives the remainder when the first number is divided by the second number

Input specification
  First, you will be given a number (n where 1 ≤ n ≤ 10). Then, each of the following n lines will contain an integer followed by a char and another integer: (e.g. 5+3). Char will be one of five operators (+, -, *, /, %) and the integers will be positive and less than 1000.

Output specification
  Show one number for every operation (line) which is the result of the given operator with the given numbers.

Sample Input:
  4
  45+20
  20-30
  7%3
  99/10

Sample Output:
  65
  -10
  1
  9


Для отправки решений необходимо выполнить вход.

www.contester.ru