Given an integer , help Chef in finding an -digit such that is divisible by but not by .
There should not be any leading zeroes in . In other words, is not a valid -digit odd positive integer.
Input Format
- The first line of input contains a single integer , denoting the number of testcases. The description of the testcases follows.
- The first and only line of each test case contains a single integer , denoting the number of digits in .
Output Format
For each testcase, output a single line containing an -digit odd positive integer in decimal number system, such that is divisible by but not by .
Sample Input 1
3
1
2
3
Sample Output 1
3
15
123
Solution:
#include<bits/stdc++.h>
using namespace std;
void solve(){
long int n;
cin>>n;
vector<int> var(n, 3);
if(n%3 == 0){
var[n-1] = 1;
var[n-2] = 2;
}
for (int i = 0; i < n; i++)
{
cout<<var[i];
}
cout<<endl;
}
int main(){
int t;
cin>>t;
while (t--)
{
solve();
}
return 0;
}
0 Comments