a788: 金馬獎4(MATH TEST)~~
標籤 : prime
通過比率 : 22人/29人 ( 76% ) [非即時]
評分方式:
Tolerant

最近更新 : 2023-03-10 20:01

內容

承 a787,本題以英文敘述

The math exam has just finished, so Y asked Frankie and Lennon again about math questions!

She asked:" Are these numbers primes? "

 

Though Frankie and Lennon wanted to tell her the answer immediately, the numbers were so big that they couldn't reply her in such a short time.

Thus, please help Frankie and Lennon write a program in order to answer her rapidly.

輸入說明

There are many lines of inputs.

(There are only about 100 lines of test cases inside the input file)

Each line has a number n, which n is less than $2^{47}$.

輸出說明

If n is a prime, print: "PRIME!!!".

While n is not a prime, print: "nope".

範例輸入
3
1
1000000007
範例輸出
PRIME!!!
nope
PRIME!!!
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 0.3s , <1M
提示 :

Faster Faster Faster

*Don't try to use getcharI/O*

*Miller-Rabin is OK, but there's no need~~*

標籤:
prime
出處:
[管理者:
frankie (34104)
]


編號 身分 題目 主題 人氣 發表日期
1665
frankie (34104)
a788
about miller-rabin
199 2022-07-06 19:00
1663
william1010121 (郭勝威)
a788
220 2022-07-06 00:10