UVA 12602 - Nice Licence Plates Shipu Ahamed - 01 Sep 2020 Problem PDFSolution:/************************************* ******** Team : BUBT_HIDDEN ********** ************************************** *********** Shipu Ahamed ************* *************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define sc scanf #define pf printf #define ll long long #define pi 2*acos(0.0) #define ff first #define se second #define inf (1<<30) //infinity value #define pb push_back #define mod 1000000007 #define ST(v) sort(v.begin(),v.end()) #define cover(a,d) memset(a,d,sizeof(a)) #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define maxall(v) *max_element(v.begin(),v.end()) #define minall(v) *min_element(v.begin(),v.end()) #define un(v) ST(v), v.erase(unique(v.begin(),v.end()),v.end()) using namespace std; int main() { char s[100],p[100]; int t,sum,res; cin>>t; while(t--) { sc("%s",s); int j=0; for(int i=4;i<8;i++) p[j++]=s[i]; p[j]='\0'; sum=atoi(p); res=((toascii(s[0])-65)*(26*26))+((toascii(s[1])-65)*26)+(toascii(s[2])-65); if(abs(res-sum)<=100) pf("nice\n"); else pf("not nice\n"); } return 0; } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/12602/12602.cpp