标签:des style blog class c code
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 3204 | Accepted: 1245 |
Description
Input
Output
Sample Input
0 9999
1 5
-1 -1
Sample Output
1229
3
#include<iostream> #include<cstdio> #include<cmath> using namespace std; bool is_prime(int n) { if(n<=0||n==1) //贡献1 WA,a,b可能小于0;so n<=0 return false; return false; for(int i=2;i<=sqrt((double)n);i++) { if(n%i==0) return false; } return true; } int main() { int a,b; int sum; while(1) { sum=0; scanf("%d%d",&a,&b); if(a==-1&&b==-1) break; for(int i=a;i<=b;i++) if(is_prime(i)) ++sum; printf("%d\n",sum); } return 0; }
Python3.2官方文档-日志和弱引用,布布扣,bubuko.com
标签:des style blog class c code
原文地址:http://blog.csdn.net/sxb0841901116/article/details/26183855