JCOINS - Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Janmansh Agarwal
Tester: Takuki Kurokawa
Editorialist: Kanhaiya Mohan

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Janmansh received X coins of 10 rupees and Y coins of 5 rupees from Chingari. Since he is weak in math, can you find out how much total money he has?

EXPLANATION:

Janmansh has X coins of 10 rupees and Y coins of 5 rupees.

Thus, money in the form of 10 rupee coins = 10\cdot X rupees.
Similarly, money in the form of 5 rupee coins = 5\cdot Y rupees.

Total money he has = 10\cdot X + 5\cdot Y rupees.

TIME COMPLEXITY:

The time complexity is O(1) per test case.

SOLUTION:

Tester's Solution
#include <bits/stdc++.h>
using namespace std;

int main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int x, y;
        cin >> x >> y;
        cout << 10 * x + 5 * y << endl;
    }
    return 0;
}
Editorialist's Solution
#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int x, y;
	    cin>>x>>y;
	    cout<< 10 * x + 5 * y <<endl;
	}
	return 0;
}