Code: Select all
10
ABC-0123
AAA-9999
FVB-7651
TGH-0001
ILL-8999
LOL-0012
ABA-0123
AMD-9786
KKK-6666
AAA-0000
Code: Select all
nice
not nice
not nice
not nice
not nice
not nice
nice
not nice
not nice
nice
Moderator: Board moderators
Code: Select all
10
ABC-0123
AAA-9999
FVB-7651
TGH-0001
ILL-8999
LOL-0012
ABA-0123
AMD-9786
KKK-6666
AAA-0000
Code: Select all
nice
not nice
not nice
not nice
not nice
not nice
nice
not nice
not nice
nice
Code: Select all
9
BBZ-0627
BBZ-0626
BBZ-0827
BBZ-0828
KHI-6950
KHI-7051
KHI-7050
KHI-6850
KHI-6849
Code: Select all
nice
not nice
nice
not nice
nice
not nice
nice
nice
not nice
Code: Select all
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
int n, fpn, spn;
string s;
cin >> n;
getchar();
for (int i=0; i<n; i++){
getline(cin, s, '-');
fpn = (s[0]-65)*52+(s[1]-65)*26+(s[2]-65);
getline(cin, s, '\n');
spn = atoi(s.c_str());
if (abs(fpn-spn)<=100)
cout << "nice" << endl;
else
cout << "not nice" << endl;
//cout << fpn << " " << spn << endl;
}
return 0;
}
How about at least trying the test cases posted right above your post and seeing what happens?ashek.rahman wrote:What is the problem in my code? I got wrong answer. Please help.
Code: Select all
/* Read in the number of plates */
scanf("%d", &numberOfPlates);
Please use code tags when sharing input / output. It makes things easier to read.ashek.rahman wrote:@v1n1t...For your given testcase the following output is shown:
Next, BBZ does not equal 103. Read the problem statement more carefully.I think your answer is wrong. Because BBZ = 103 and abs(103,627)=524>100. So I think it is "not nice".