LEARNSQL - Editorial

PROBLEM LINK:

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

Tester: udhav2003
Editorialist: iceknight1093

DIFFICULTY:

339

PREREQUISITES:

None

PROBLEM:

Chef is learning SQL from the new CodeChef SQL course.
He has a table which initially has R rows and C columns. He then adds E extra rows to it. How many total cells does he have finally?

EXPLANATION:

After adding the new rows:

  • The total number of rows is R + E.
  • The total number of columns is C.
  • So, the total number of cells equals their product, i.e
(R+E)\times C

TIME COMPLEXITY

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

CODE:

Editorialist's code (Python)
r, c, e = map(int, input().split())
print(r*c + e*c)