一道ACM水题,还可以怎么简化呢?
问题描述:
一道ACM水题,还可以怎么简化呢?
Description
A prime number is a natural number which has exactly two distinct natural number divisors:1 and itself.The first prime number is 2.Can you write a program that computes the nth prime number,given a number n
答
传统法优化后.int prime(int n){ int i;double t;if(n%2!=0 || n==2){if(n==2)return 1;else{t=sqrt(n); //#includefor(i=3;it) ...