시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 972 618 579 64.765%

문제

앨버타의 자동차 번호판은 ABC-0123 (세 글자, 네 숫자)와 같이 두 부분으로 나누어져 있다.

좋은 번호판은 첫 번째 부분의 가치와 두 번째 부분의 가치의 차이가 100을 넘지 않는 번호판이다.

글자로 이루어진 첫 번째 부분의 가치는 글자를 26진법 숫자처럼 계산하다. (각 자리가 [A..Z]) 예를 들어, "ABC"의 가치는 28 (0*26^2 + 1*26^1 + 2*26^0)이 된다. "ABC-0123"은  |28 - 123| <= 100 이기 때문에, 좋은 번호판이다.

자동차 번호판이 주어졌을 때, 좋은 번호판인지 아닌지를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 번호판의 수 N (1 ≤ N ≤ 100)이 주어진다. 다음 N개 줄에는 자동차 번호판이 LLL-DDDD 형식으로 주어진다.

출력

각각의 자동차 번호판에 대해서, 좋은 번호판이면 "nice"를, 아니면 "not nice"를 출력한다.

예제 입력 1

2
ABC-0123
AAA-9999

예제 출력 1

nice
not nice
W3sicHJvYmxlbV9pZCI6IjE4NzEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM4OGJcdWM3NDAgXHVjNzkwXHViM2Q5XHVjYzI4IFx1YmM4OFx1ZDYzOFx1ZDMxMCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjNTY4XHViYzg0XHVkMGMwXHVjNzU4IFx1Yzc5MFx1YjNkOVx1Y2MyOCBcdWJjODhcdWQ2MzhcdWQzMTBcdWM3NDAgQUJDLTAxMjMgKFx1YzEzOCBcdWFlMDBcdWM3OTAsIFx1YjEyNCBcdWMyMmJcdWM3OTApXHVjNjQwIFx1YWMxOVx1Yzc3NCBcdWI0NTAgXHViZDgwXHViZDg0XHVjNzNjXHViODVjIFx1YjA5OFx1YjIwNFx1YzViNFx1YzgzOCBcdWM3ODhcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1Yzg4Ylx1Yzc0MCBcdWJjODhc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G48cD5HaXZlbiB0aGUgbGlzdCBvZiBsaWNlbmNlIHBsYXRlIG51bWJlcnMsIHlvdXIgcHJvZ3JhbSBzaG91bGQgZGV0ZXJtaW5lIGlmIHRoZSBwbGF0ZSBpcyBuaWNlIG9yIG5vdC48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPkZpcnN0IGxpbmUgb2YgdGhlIGlucHV0IGNvbnRhaW5zIGFuIGludGVnZXIgTiAoMSZsdDs9TiZsdDs9MTAwKSwgdGhlIG51bWJlciBvZiBsaWNlbmNlIHBsYXRlIG51bWJlcnMuIFRoZW4gZm9sbG93IE4gbGluZXMsIGVhY2ggY29udGFpbmluZyBhIGxpY2VuY2UgcGxhdGUgaW4gdGhlIGZvcm1hdCBMTEwtRERERC48XC9wPlxyXG5cclxuPHA+Jm5ic3A7PFwvcD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggbGljZW5jZSBwbGF0ZSBwcmludCBvbiBhIGxpbmUgJnF1b3Q7bmljZSZxdW90OyBvciAmcXVvdDtub3QgbmljZSZxdW90OyAod2l0aG91dCBxdW90ZXMpIGRlcGVuZGluZyBvbiB0aGUgcGxhdGUgbnVtYmVyIGJlaW5nIG5pY2UgYXMgZGVzY3JpYmVkIGluIHRoZSBwcm9iZW0gc3RhdGVtZW50LjxcL3A+XHJcblxyXG48cD4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > North America > Rocky Mountain Regional > Alberta Collegiate Programming Contest > ACPC 2012 A번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: imgosari