Logo
(追記) (追記ここまで)

4937번 - It’s All About Three 다국어

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

문제

Consider the series of numbers whose all prime factors have 3 as their least (right-most) digit. For example, the first 10 numbers in this series are:

3 9 13 23 27 39 43 53 69 73

The numbers 3, 13, 23, 43, 53, and 73 are in this series since they’re all primes whose least digit is a 3. Whereas 9 (3∗3,) 27 (3∗3∗3,) 39 (3∗13,) and 69 (23∗3) are in since all their prime factors have a 3 as their least digit.

Write a program that takes a list of positive integers and determines if each integer is in this series or not.

입력

The input file contains a list of one or more positive integers, each given on a separate line. Each integer is less than a million. The last line of the file contains a -1 (which is not part of the list.)

출력

For each number in the input, write, on a separate line, the number itself followed by the word "YES" if the number is in the series described above, or "NO" if it isn’t. Separate the number from the answer by a single space.

제한

예제 입력 1

3
13
33
-1

예제 출력 1

3 YES
13 YES
33 NO

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > 2005 Arab Collegiate Programming Contest J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /