My issue
How the intution of base5 will come, i didnt understand how it helps how it is making equal to 5 will solve problem please explain.
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int i = 0 ; i< t ; i++){
int magical=s.nextInt();
int magic = 0 ;
int n = 0 ;
while(true){
int c = 0 ;
int temp=n;
while(n>0){
int x = n%10 ;
if(x%2 != 0){
c+=1 ;
}
n = n/10 ;
}
if(c==0){
magic+=1 ;
}
if(magic == magical ){
System.out.println(temp);
break ;
}
n=temp+1;
}
}
}
}
Learning course: 1600 to 1800 difficulty problems
Problem Link: Chef And The Hiring Event Practice Problem in - CodeChef