以下ACM题目在线等(判断大数质数)Problem F --- Prime or composite?(12:15:40)This is pretty simple,but your program needs to be very efficient.The numbers may be very large.There may be a lot of numbers.Your program must read a series of
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/15 15:33:14
![以下ACM题目在线等(判断大数质数)Problem F --- Prime or composite?(12:15:40)This is pretty simple,but your program needs to be very efficient.The numbers may be very large.There may be a lot of numbers.Your program must read a series of](/uploads/image/z/12648925-37-5.jpg?t=%E4%BB%A5%E4%B8%8BACM%E9%A2%98%E7%9B%AE%E5%9C%A8%E7%BA%BF%E7%AD%89%28%E5%88%A4%E6%96%AD%E5%A4%A7%E6%95%B0%E8%B4%A8%E6%95%B0%EF%BC%89Problem+F+---+Prime+or+composite%3F%2812%3A15%3A40%29This+is+pretty+simple%2Cbut+your+program+needs+to+be+very+efficient.The+numbers+may+be+very+large.There+may+be+a+lot+of+numbers.Your+program+must+read+a+series+of)
以下ACM题目在线等(判断大数质数)Problem F --- Prime or composite?(12:15:40)This is pretty simple,but your program needs to be very efficient.The numbers may be very large.There may be a lot of numbers.Your program must read a series of
以下ACM题目在线等(判断大数质数)
Problem F --- Prime or composite?(12:15:40)
This is pretty simple,but your program needs to be very efficient.The numbers may be very large.There may be a lot of numbers.Your program must read a series of numbers from standard input,and then print whether each number is prime or composite.
Input
The input consists of several line with a single value n on that line.The number n is nonegative and your program should halt on any number less than two.
Output
For each line,the output should either be the string "prime" (printed on a line by itself) or the string "composite" (printed on a line by itself.
Sample Input
2
3
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
6
17
1
18
0
Junk
Sample Outputprime
prime
composite
composite
prime
以下ACM题目在线等(判断大数质数)Problem F --- Prime or composite?(12:15:40)This is pretty simple,but your program needs to be very efficient.The numbers may be very large.There may be a lot of numbers.Your program must read a series of
用JAVA里面的prime函数.