PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Practice
Setter: Anish Ashish Kasegaonkar
Testers: Nishank Suresh and Abhinav Sharma
Editorialist: Anish Ashish Kasegaonkar
DIFFICULTY
296
PREREQUISITES
None
PROBLEM
Harsh was gifted a book consisting of N pages, each page consisting of M words. What is the total number of words in the book?
EXPLANATION
The answer would be the total number of pages multiplied with the total number of words per page, i.e. N\times M. This is an implementation problem, and the objective is to check your ability to accept inputs and print an output.
TIME COMPLEXITY
The time complexity is O(1) per test case.
SOLUTION
Editorialist's Solution
// Anish Kasegaonkar
#include <bits/stdc++.h>
using namespace std;
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
for (int i = 1; i <= t; ++i)
{
int n, m;
cin >> n >> m;
cout << n * m << '\n';
}
return 0;
}