PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Setter: utkarsh_adm
Tester: Harris Leung
Editorialist: hrishik85
DIFFICULTY:
267
PREREQUISITES:
None
PROBLEM:
Chef appears in a placement test and appears in a problem worth X points. The problem has 10 test cases. The Chef clears N test cases. We have to output Chef’s score for this problem
EXPLANATION:
Note that X is the maximum possible score when all 10 test cases are cleared
Hint 1
What are the points per test case?
Hint 2
10 test cases are worth X points. So each test case is worth X/10 points. Note that we are told that X is a multiple of 10.
Hint 3
So now, given that Chef clears N test cases, what will Chef’s score be?
Hint 4
It is N * (X/10).
TIME COMPLEXITY:
Time complexity is O(1).
SOLUTION:
Tester's Solution
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const ll mod=998244353;
const int N=2e5+5;
int n;
ll a[N];
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int t;cin >> t;
while(t--){
int n,x;cin >> n >> x;
cout << n/10*x << '\n';
}
}
Editorialist's Solution
t=int(input())
for _ in range(t):
X,N = map(int,input().split())
print((X//10)*N)