PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Setter: Utkarsh Gupta
Tester: Harris Leung
Editorialist: Kanhaiya Mohan
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
It is known that in regular dice, the sum of opposite faces is 7.
A regular dice is rolled and you are given the value X showing on the top face. Determine the value on the bottom face.
EXPLANATION:
We are given that the sum of values on opposite faces is 7.
If one of the faces has value X, the opposite face would have the value (7-X).
TIME COMPLEXITY:
The time complexity is O(1) per test case.
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;
int t;
int n,m;
ll a[300001];
ll s=0;
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int t;cin >> t;
while(t--){
int x;
cin >> x;
cout << 7-x << '\n';
}
}
Editorialist's Solution
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int x;
cin>>x;
cout<<7-x<<endl;
}
return 0;
}