Search found 7 matches

by fahmi
Sat Jan 10, 2009 9:13 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32230

Re: 10394 - Twin Primes

thnx every1.i have got Accepted :lol:
by fahmi
Sat Jan 10, 2009 7:55 pm
Forum: Volume 9 (900-999)
Topic: 974 - Kaprekar Numbers
Replies: 32
Views: 11792

Re: 974 - Kaprekar Numbers

can any1 tell me why i m getting TLE??plzzzz help #include<stdio.h> int kaprekar(long long n) { long long i,j,c,p[100],x,y,z,f; x=n*n; i=0; f=0; while(x>0) { y=x%10; p[i++]=y; z=x/10; c=0; for(j=i-1;j>=0;j--) { c=c*10+p[j]; } if(c+z==n&&c!=0&&z!=0) { f=1; break; } x=z; } return f; } int main() { lon...
by fahmi
Sat Jan 10, 2009 6:29 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32230

Re: 10394 - Twin Primes

using i+=6,my code is..but still big numbers cannot b executed #include<stdio.h> #include<math.h> long long a[100000],c,flag[1000000],b[10000][10000]; void seive(long long n) { long long k,i,j,r; k=sqrt(n); for(i=1;i<=n;i++) flag[i]=0; flag[1]=1; a[0]=2; c=1; for(i=4;i<=n;i+=2) flag[i]=1; for(i=3;i<...
by fahmi
Sat Jan 10, 2009 6:24 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32230

Re: 10394 - Twin Primes

my code doesnt work for 100000.what can i do now?? plz som1 help #include<stdio.h> #include<math.h> long long a[100000],c,flag[1000000],b[10000][100]; void seive(long long n) { long long k,i,j,r; k=sqrt(n); for(i=1;i<=n;i++) flag[i]=0; flag[1]=1; a[0]=2; c=1; for(i=4;i<=n;i+=2) flag[i]=1; for(i=3;i<...
by fahmi
Sat Jan 10, 2009 4:51 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 36747

Re: 583 - Prime Factors

& this is my code without using Array,but getting TLE.i cant fix whats d wrong with my code.plzzzz help :( #include<stdio.h> int main() { long long n,i,j,f; while(scanf("%lld",&n)==1) { if(n==0) break; else if(n==1) { printf("1 =\n"); continue; } f=0; printf("%lld =",n); if(n<0) { printf(" -1"); f=1...
by fahmi
Sat Jan 10, 2009 4:49 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 36747

Re: 583 - Prime Factors

can any1 help me plz??? this is the code with seive & array,but having RTE #include<stdio.h> #include<math.h> long long prime[3550],flag[10000],c=0,a[100000000]; void seive(int n) { long long k,i,j,r; k=sqrt(n); for(i=1;i<=n;i++) flag[i]=0; flag[1]=1; prime[0]=2; c=1; for(i=4;i<=n;i+=2) flag[i]=1; f...
by fahmi
Sat Jan 10, 2009 4:43 pm
Forum: Volume 114 (11400-11499)
Topic: 11466 - Largest Prime Divisor
Replies: 29
Views: 15550

Re: 11466 - Largest Prime Divisor

pllzzzz help..y i m getting WA.i cant fix d d problm with my code.plz som1 help :( Fahmi #include<stdio.h> #include<math.h> #include<stdlib.h> long long a[100000],c,flag[1000000]; void seive(int n) { long long k,i,j,r; k=sqrt(n); for(i=1;i<=n;i++) flag[i]=0; flag[1]=1; a[0]=2; c=1; for(i=4;i<=n;i+=2...

Go to advanced search