i solved uva 568 to find out the last non zero digit of n!
and got accepted. here is my code
#include<stdio.h>
#define max 20000000
#define lmt 4473
unsigned flag[max>>6];
#define ifc(n) (flag[n>>6]&(1<<((n>>1)&31)))
#define isc(n) (flag[n>>6]|=(1<<((n>>1)&31)))
int power(int prime,int n)
{
int ...
Search found 11 matches
- Mon Dec 30, 2013 3:03 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10212 - The Last Non-zero Digit.
- Replies: 63
- Views: 41353
- Sat Dec 21, 2013 8:15 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10176 - Ocean Deep ! - Make it shallow !!
- Replies: 37
- Views: 18787
Re: 10176 - Ocean Deep! Make it shallow!!
i am getting WA ,,, but failed to find out what is the wrong!! :roll:
#include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
char str[20000],temp[20000];
int i,j=0;
while(scanf("%c",&str[0])==1)
{
j=0;
int p=0;
if(str ...
#include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
char str[20000],temp[20000];
int i,j=0;
while(scanf("%c",&str[0])==1)
{
j=0;
int p=0;
if(str ...
- Wed Dec 04, 2013 10:02 am
- Forum: Volume 2 (200-299)
- Topic: 294 - Divisors
- Replies: 91
- Views: 39239
Re: 294 - Divisors WA!!!
oh.i didnt notice it . but my compiler was always giving correct output for sample input while other compilers were not!brianfry713 wrote:Try running your code on the sample input
thanx a lot

- Tue Dec 03, 2013 7:00 pm
- Forum: Volume 2 (200-299)
- Topic: 294 - Divisors
- Replies: 91
- Views: 39239
Re: 294 - Divisors WA!!!
why WA? couldnt find out!!
:roll:
my code-
#include<stdio.h>
#include<math.h>
int divisor(int n)
{
int i,div;
double sqrtn;
if(n==1)
return 1;
else if(n==2)
return 2;
else{
div=2;
sqrtn=sqrt(n);
for(i=2;i<sqrtn;i++)
{
if(n%i==0)
{
div=div+2;
}
}
if(sqrtn*sqrtn==n)
div ...
:roll:
my code-
#include<stdio.h>
#include<math.h>
int divisor(int n)
{
int i,div;
double sqrtn;
if(n==1)
return 1;
else if(n==2)
return 2;
else{
div=2;
sqrtn=sqrt(n);
for(i=2;i<sqrtn;i++)
{
if(n%i==0)
{
div=div+2;
}
}
if(sqrtn*sqrtn==n)
div ...
- Wed Nov 13, 2013 8:50 am
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
Re: 11428 - Cubes
thanx brianfry ..thanx a lot.is the cuberoot the cause?
- Tue Nov 12, 2013 7:30 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
Re: 11428 - Cubes
i add 0.0003 with the double value. but i am still getting WA. i have also tried with float. i tested my code for all the values from 1 t0 10000.plz,brianfry..tell me if the algorithm is ok! if its not then why?! and how can i improve this?
after adding 0.003 here is my new code-
plz help me ...
after adding 0.003 here is my new code-
plz help me ...
- Sat Nov 09, 2013 6:23 am
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
- Sat Nov 09, 2013 6:19 am
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
Re: 11428 - Cubes
Hi brianfry, for 631 my output is 15 14
- Fri Nov 08, 2013 11:02 am
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
Re: 11428 -Why WA?
plz...Help me
i am just a beginner
[removed]
i am just a beginner
[removed]
- Fri Nov 08, 2013 1:54 am
- Forum: Volume 114 (11400-11499)
- Topic: 11428 - Cubes
- Replies: 64
- Views: 27520
11428-I am tired getting WA again& again
plz...Help me :oops:
i am just a beginner :(
#include<cstdio>
#include<cmath>
int main()
{
long int t,i,a,N,x=0;
int c;
double p,b;
while(scanf("%ld",&N)==1)
{
if(N==0)
break;
p=sqrt((double)N);
for(i=1;i<=(int)p;i++)
{
a=N+(i*i*i);
b=cbrt((double)a);
c=(int)b;
t=(c*c*c)-(i*i*i);
if(t==N)
{
x=1 ...
i am just a beginner :(
#include<cstdio>
#include<cmath>
int main()
{
long int t,i,a,N,x=0;
int c;
double p,b;
while(scanf("%ld",&N)==1)
{
if(N==0)
break;
p=sqrt((double)N);
for(i=1;i<=(int)p;i++)
{
a=N+(i*i*i);
b=cbrt((double)a);
c=(int)b;
t=(c*c*c)-(i*i*i);
if(t==N)
{
x=1 ...
- Thu Oct 24, 2013 10:26 am
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71563
623
getting TLE..i tried to solve it using C
my code-
#include<stdio.h>
int main()
{
int ara1[2600],ara2[2600],ara3[2600],sum[2600],uff[1001];
long int i,a,d1,l1=0,d2,l2=0,j,m,t,k,p=0,l4=0,q=0,x,A,B=0,C,T,s,max=0,f=0,y,u=0;
char fin[1001][2600];
while(scanf("%ld",&d1)==1)
{
uff =d1;
u++;
if(d1 ...
my code-
#include<stdio.h>
int main()
{
int ara1[2600],ara2[2600],ara3[2600],sum[2600],uff[1001];
long int i,a,d1,l1=0,d2,l2=0,j,m,t,k,p=0,l4=0,q=0,x,A,B=0,C,T,s,max=0,f=0,y,u=0;
char fin[1001][2600];
while(scanf("%ld",&d1)==1)
{
uff =d1;
u++;
if(d1 ...