字典翻译 问答 小学 英语 【以下ACM题目在线等(判断大数质数)ProblemF---Primeorcomposite?(12:15:40)Thisisprettysimple,butyourprogramneedstobeveryefficient.Thenumbersmaybeverylarge.Theremaybealotofnumbers.Yourprogrammustreadaseriesof】
问题标题:
【以下ACM题目在线等(判断大数质数)ProblemF---Primeorcomposite?(12:15:40)Thisisprettysimple,butyourprogramneedstobeveryefficient.Thenumbersmaybeverylarge.Theremaybealotofnumbers.Yourprogrammustreadaseriesof】
问题描述:

以下ACM题目在线等(判断大数质数)

ProblemF---Primeorcomposite?(12:15:40)

Thisisprettysimple,butyourprogramneedstobeveryefficient.Thenumbersmaybeverylarge.Theremaybealotofnumbers.Yourprogrammustreadaseriesofnumbersfromstandardinput,andthenprintwhethereachnumberisprimeorcomposite.

Input

Theinputconsistsofseverallinewithasinglevaluenonthatline.Thenumbernisnonegativeandyourprogramshouldhaltonanynumberlessthantwo.

Output

Foreachline,theoutputshouldeitherbethestring"prime"(printedonalinebyitself)orthestring"composite"(printedonalinebyitself.

SampleInput

2

3

1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

6

17

1

18

Junk

SampleOutputprime

prime

composite

composite

prime

纪新瑞回答:
  用JAVA里面的prime函数.
点击显示
英语推荐
热门英语推荐
  • 语文
  • 数学
  • 英语
  • 科学
  • 作文