PROBLEM LINK:CodeChef: Practical coding for everyone
Author: Abhishek Yadav
Tester: Abhishek Yadav
Editorialist: Abhishek Yadav
DIFFICULTY:
MEDIUM
PREREQUISITES:
Math
PROBLEM:
You have found a locked safe which is full of Magical Laddu’s. You want to eat them as soon as possible so you start to break the password of the safe. This safe has a digital display which display’s a integer on the screen and according to it you have to find the password of the safe.
QUICK EXPLANATION:
The algorithm to crack this pattern is If the Number on the display is N then answer for the N will be equal to ( N x N x 11) / 4.
EXPLANATION:
If you observe the numbers carefully then you will find that the numbers are following some pattern.
The algorithm to crack this pattern is If the Number on the display is N then answer for the N will be equal to ( N x N x 11) / 4.
As the constraints are large so the output will also be very large.
So to handle this constraints in the language like c,c++ you can use array or unsigned long long int.
SOLUTIONS:
Setter's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
unsigned long long int n,cnt=0;
cin>>n;
unsigned long long int k;
k=(nn11)/4;
cout<<k<<“\n”;
}
}
Tester's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
unsigned long long int n,cnt=0;
cin>>n;
unsigned long long int k;
k=(nn11)/4;
cout<<k<<“\n”;
}
}
Editorialist's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
unsigned long long int n,cnt=0;
cin>>n;
unsigned long long int k;
k=(nn11)/4;
cout<<k<<“\n”;
}
}