CREDS - Editorial

PROBLEM LINK:

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

Author: Daanish Mahajan
Testers: Jeevan Jyot Singh, Hriday
Editorialist: Nishank Suresh

DIFFICULTY:

306

PREREQUISITES:

None

PROBLEM:

This semester, you have taken X RTP courses (worth 4 credits each), Y audit courses (worth 2 credits each), and Z Non-RTP courses (worth no credits).

How many credits worth of courses have you taken?

EXPLANATION

The RTP courses are worth 4\cdot X credits in total, and the audit courses are worth 2\cdot Y credits in total.

That makes a total of 4\cdot X + 2\cdot Y credits.

TIME COMPLEXITY

\mathcal{O}(1) per test case.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    x, y, z = map(int, input().split())
    print(4*x + 2*y)