#include<bits/stdc++.h>
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
#define putcase2 cout<<"Case #"<<++cse<<":"
using namespace std;
int main()
{
string s ,t;
int T;
cin>>T;
while(T--){
int sum=0;
cin>>s;
int p=2;
t=s.substr(4,4);
int prevValue=atoi(t.c_str());
ff(i,0,4){
int mul;
ff(j,65,91){
if(s[i]==j){
mul=j-65;
break;
}
}
// dbug(mul);
sum+=mul*(pow(26,p));
p--;
}
// dbug(sum);
if(abs(prevValue-sum)<=100)
cout<<"nice\n";
else
cout<<"not nice\n";
}
return 0;
}
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
#define putcase2 cout<<"Case #"<<++cse<<":"
using namespace std;
int main()
{
string s ,t;
int T;
cin>>T;
while(T--){
int sum=0;
cin>>s;
int p=2;
t=s.substr(4,4);
int prevValue=atoi(t.c_str());
ff(i,0,4){
int mul;
ff(j,65,91){
if(s[i]==j){
mul=j-65;
break;
}
}
// dbug(mul);
sum+=mul*(pow(26,p));
p--;
}
// dbug(sum);
if(abs(prevValue-sum)<=100)
cout<<"nice\n";
else
cout<<"not nice\n";
}
return 0;
}
No comments:
Post a Comment