# LuckyGame(https://www.codechef.com/SMCC2021/problems/LUCKY02)

Practice

Author: Sachin Singh
Tester: Sachin Singh
Editorialist: Sachin Singh

EASY.

Math .

# PROBLEM:

On the day of the annual fest of the college,some teachers and student decided to organize a game .

Game is very simple. There are numbers of slips on the table(Natural number written on slip). One by one participant will come and choose a slip.

if the number written on the slip contains only 3 and 7 then print LUCKY otherwise print BETTER LUCK NEXT TIME.

# QUICK EXPLANATION:

You have given a number N.You have to check whether the number N contain only 3 and 7 or not.

# EXPLANATION:

You have to given a number N. Suppose number is 37773. This number only contains 3 and 7.So it’s output is LUCKY.
Suppose you have to given number 7777777.it’s output is also LUCKY because it contains
number only 7.
Consider one more example 3476.It’s is not a lucky number because this number contains 4 and 6.

# SOLUTIONS:

Setter's Solution

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

int main()
{
int t;
cin>>t;
while(t–)
{
int n,j=0;
cin>>n;
while(n>0)
{
int k=n%10;
n=n/10;
if(k!=7 && k!=3)
{
cout<<“BETTER LUCK NEXT TIME”<<endl;
j=1;
break;
}
//n=n/10;
}
if(j==0)
{
cout<<“LUCKY”<<endl;
}
}
}

Tester's Solution

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

int main()
{
int t;
cin>>t;
while(t–)
{
int n,j=0;
cin>>n;
while(n>0)
{
int k=n%10;
n=n/10;
if(k!=7 && k!=3)
{
cout<<“BETTER LUCK NEXT TIME”<<endl;
j=1;
break;
}
//n=n/10;
}
if(j==0)
{
cout<<“LUCKY”<<endl;
}
}
}

Editorialist's Solution

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

int main()
{
int t;
cin>>t;
while(t–)
{
int n,j=0;
cin>>n;
while(n>0)
{
int k=n%10;
n=n/10;
if(k!=7 && k!=3)
{
cout<<“BETTER LUCK NEXT TIME”<<endl;
j=1;
break;
}
//n=n/10;
}
if(j==0)
{
cout<<“LUCKY”<<endl;
}
}
}