Easy question

i am not entering into loop after 2nd iteration why it happens ???
help me with this

question : https://www.hackerearth.com/problem/algorithm/easy-question/submissions/

or

This is the easiest question of the entire set. :smiley:

Just find 6n and print last two digits.

Note : Suppose if your answer is 06 then print just 6.

Input

The first line of the input contains a single integer T (1 ≤ T≤ 10^5) — the number of test cases.

Each test case contains a single line containing single number n . ( 1 <= n <= 10^50 )

Output

Print T lines. In each line print the desired output

mysoultion:

#include <bits/stdc++.h>
using namespace std;

int LastTwoDigit(long long int num)
{

int one = num % 10; 
num /= 10; 
int tens = num % 10; 
tens *= 10; 
num = tens + one; 
return num; 

}

// Driver program
int main()
{
int t ;
cin>>t;
while(t–)//it is (t - -) not ( t - )
{
long long int n;
cin>>n;
long long int num = 1;
num = pow(6, n);
cout << LastTwoDigit(num) << endl;

}

return 0; 

}

Wrong syntax in starting of the while loop, you are supposed to write while (t—) (2 minuses) instead of while (t-) (one minus)

1 Like

Its error is formatting here

Observe the constraints on n. It is 10^50. Int or even long long int cannot hold such a large number. So you need to use string. I am not sure, how to find 6^n for such a large number. But if it is 6*N, you can simply use Kasturba’s algorithm for multiplication of string and simply output the last two characters.

1 Like

I don’t think that we need to apply kasturba’s algorithm over here, it is supposed to be a very easy problem.

question is right
constarints :
The first line of the input contains a single integer T (1 ≤ T≤ 10^5) — the number of test cases.

Each test case contains a single line containing single number n . ( 1 <= n <= 10^50 )

if you have any doubt regarding constraints you can click that link…

yes i think so
we have to use string instead of int

i have written (t - -) only not (t-)

I just executed your solution, it works fine.
Are you using correct input scheme
First line has the number of testcases and the following n lines are the powers of 6.