시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB28701740157863.603%

문제

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

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

글자로 이루어진 첫 번째 부분의 가치는 글자를 26진법 수처럼 계산한다. (각 자리가 [A..Z]) 예를 들어, "ABC"의 가치는 28 (0×262 + 1×261 + 2×260)이 된다. "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+XHVjNTY4XHViYzg0XHVkMGMwXHVjNzU4IFx1Yzc5MFx1YjNkOVx1Y2MyOCBcdWJjODhcdWQ2MzhcdWQzMTBcdWM3NDAgQUJDLTAxMjMgKFx1YzEzOCBcdWFlMDBcdWM3OTAsIFx1YjEyNCBcdWMyMmJcdWM3OTApXHVjNjQwIFx1YWMxOVx1Yzc3NCBcdWI0NTAgXHViZDgwXHViZDg0XHVjNzNjXHViODVjIFx1YjA5OFx1YjIwNFx1YzViNFx1YzgzOCBcdWM3ODhcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1Yzg4Ylx1Yzc0MCBcdWJjODhcdWQ2MzhcdWQz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sIHRoZSBwbGF0ZSAmcXVvdDtBQkMtMDEyMyZxdW90OyBpcyBuaWNlLCBiZWNhdXNlIHwyOC0xMjN8Jmx0Oz0xMDAuPFwvcD5cclxuXHJcbjxwPkdpdmVuIHRoZSBsaXN0IG9mIGxpY2VuY2UgcGxhdGUgbnVtYmVycywgeW91ciBwcm9ncmFtIHNob3VsZCBkZXRlcm1pbmUgaWYgdGhlIHBsYXRlIGlzIG5pY2Ugb3Igbm90LjxcL3A+XHJcbiIsImlucHV0IjoiPHA+Rmlyc3QgbGluZSBvZiB0aGUgaW5wdXQgY29udGFpbnMgYW4gaW50ZWdlciBOICgxJmx0Oz1OJmx0Oz0xMDApLCB0aGUgbnVtYmVyIG9mIGxpY2VuY2UgcGxhdGUgbnVtYmVycy4gVGhlbiBmb2xsb3cgTiBsaW5lcywgZWFjaCBjb250YWluaW5nIGEgbGljZW5jZSBwbGF0ZSBpbiB0aGUgZm9ybWF0IExMTC1ERERELjxcL3A+XHJcblxyXG48cD4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCBsaWNlbmNlIHBsYXRlIHByaW50IG9uIGEgbGluZSAmcXVvdDtuaWNlJnF1b3Q7IG9yICZxdW90O25vdCBuaWNlJnF1b3Q7ICh3aXRob3V0IHF1b3RlcykgZGVwZW5kaW5nIG9uIHRoZSBwbGF0ZSBudW1iZXIgYmVpbmcgbmljZSBhcyBkZXNjcmliZWQgaW4gdGhlIHByb2JlbSBzdGF0ZW1lbnQuPFwvcD5cclxuXHJcbjxwPiZuYnNwOzxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJodG1sX3RpdGxlIjoiMCIsInByb2JsZW1fbGFuZ190Y29kZSI6IkVuZ2xpc2gifV0=

출처

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