KNGTOR- Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: Parth Prajapati
Testers: Nishank Suresh, Tejas Pandey
Editorialist: Nishank Suresh

DIFFICULTY:

283

PREREQUISITES:

None

PROBLEM:

King has N 5-seater cars and M \ 7-seaters. How many people can travel in them?

EXPLANATION:

The 5-seaters can accomodate 5N people in total, while the 7-seaters can accomodate 7M. So, the total number is

5N+7M

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    n, m = map(int, input().split())
    print(5*n + 7*m)