标签:style blog http color os io for 2014
#include<stdio.h> int main() { int n,a,b,i; int sum=0 ; scanf("%d%d",&a,&b); { for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) sum+=n; } printf("%d",sum); printf("\n"); } }
#include<stdio.h>
int main()
{
int n,a,b,i;
int sum=0 ;
scanf("%d%d",&a,&b);
{
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
sum+=n;
}
printf("%d",sum);
printf("\n");
}
}
#include<stdio.h> int main() { int n,a,b,i; int sum=0 ; while ( scanf("%d%d",&a,&b)==2) { for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) sum+=n; } printf("%d",sum); printf("\n"); } }
#include<stdio.h>
int main()
{
int n,a,b,i;
int sum=0 ;
while ( scanf("%d%d",&a,&b)==2)
{
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
sum+=n;
}
printf("%d",sum);
printf("\n");
}
}
****************************************************************************************************************************************
#include<stdio.h> int main() { int n,a,b,i; int j,s; int c[1000]; while ( scanf("%d%d",&a,&b)==2) { j=0; for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) c[j++]=n; } s=0; for (i=0;i<j;i++) s=s+c[i]; printf("%d\n",s); } return 0; }
#include<stdio.h>
int main()
{
int n,a,b,i;
int j,s;
int c[1000];
while ( scanf("%d%d",&a,&b)==2)
{
j=0;
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
c[j++]=n;
}
s=0;
for (i=0;i<j;i++)
s=s+c[i];
printf("%d\n",s);
}
return 0;
}
标签:style blog http color os io for 2014
原文地址:http://www.cnblogs.com/2014acm/p/3901206.html