Can anyone please tell me why m i getting WA??
#include<stdio.h>
#include<string.h>
#include<math.h>
int decimal(char s1[])
{
int i,n,sum=0;
n=strlen(s1);
for(i=n-1;i>=0;i--)
{
if(s1[i]=='A')
sum+=(10*pow(16,n-i-1));
else if(s1[i]=='B')
sum+=(11*pow(16,n-i-1));
else if(s1[i]=='C')
sum ...
Search found 21 matches
- Tue Jan 15, 2008 8:02 pm
- Forum: Volume 4 (400-499)
- Topic: 446 - Kibbles "n" Bits "n" Bits "n" Bits
- Replies: 50
- Views: 11465
- Wed Jan 09, 2008 9:41 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10189 - Minesweeper
- Replies: 418
- Views: 124792
424(WA)
WHy am i getting WA?? any help
#include<iostream>
using namespace std;
int check(int i, int j, int x, int y, char b[][105]);
main()
{
int i,j,k=0,m,n,z;
char a[105][105];
while(1)
{
cin >> m >> n;
if(m==0&&n==0)
break;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin >> a[i][j];
k++;
for(i=0;i ...
#include<iostream>
using namespace std;
int check(int i, int j, int x, int y, char b[][105]);
main()
{
int i,j,k=0,m,n,z;
char a[105][105];
while(1)
{
cin >> m >> n;
if(m==0&&n==0)
break;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin >> a[i][j];
k++;
for(i=0;i ...
- Wed Jan 09, 2008 8:18 pm
- Forum: Volume 4 (400-499)
- Topic: 424 - Integer Inquiry
- Replies: 96
- Views: 38497
- Mon Dec 31, 2007 8:13 am
- Forum: Volume 103 (10300-10399)
- Topic: 10300 - Ecological Premium
- Replies: 22
- Views: 13436
acm-10300(CE)
Can anyonw please tell me why I m getting CE in this prob??
//------- 10300 ------- //
#include<iostream>
using namespace std;
void main(void)
{
long n,m,m1,m2,m3,i,j,s;
//scanf("%ld",&n);
cin>>n;
for(i=0;i<n;i++)
{
s=0;
cin>>m;
for(j=0;j<m;j++)
{
cin>>m1>>m2>>m3;
s+=(m1*m3);
}
cout ...
//------- 10300 ------- //
#include<iostream>
using namespace std;
void main(void)
{
long n,m,m1,m2,m3,i,j,s;
//scanf("%ld",&n);
cin>>n;
for(i=0;i<n;i++)
{
s=0;
cin>>m;
for(j=0;j<m;j++)
{
cin>>m1>>m2>>m3;
s+=(m1*m3);
}
cout ...
- Wed Dec 19, 2007 9:36 pm
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies: 109
- Views: 41064
TLE .......543
I m still TLE..but it's work for all critical i/0..
here is my code.
here is my code.
Code: Select all
AC
- Tue Dec 18, 2007 10:03 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10320 - Cow Trouble! Help Please!!
- Replies: 27
- Views: 13209
10320(Needed formula)
Can anyone plz tell me How can I evaluate the formula when R>(l+w)??
- Mon Dec 17, 2007 9:01 pm
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies: 109
- Views: 41064
543 TLE
[/code]#include<stdio.h>
#include<math.h>
main()
{
long n,k=0,i,j,l,m,a[200000],p,z,news;
while(1)
{
for(i=3;i<=n;i+=2)
{
z=0;
news=sqrt(i);
for(j=3;j<=news;j+=2)
if(i%j==0)
{
z=1;
break;
}
if(z==0)
{
a[k]=i;
k++;
}
}
scanf("%ld",&n);
if(n==0)
break;
p=0,l=0,m=0;
for(i ...
#include<math.h>
main()
{
long n,k=0,i,j,l,m,a[200000],p,z,news;
while(1)
{
for(i=3;i<=n;i+=2)
{
z=0;
news=sqrt(i);
for(j=3;j<=news;j+=2)
if(i%j==0)
{
z=1;
break;
}
if(z==0)
{
a[k]=i;
k++;
}
}
scanf("%ld",&n);
if(n==0)
break;
p=0,l=0,m=0;
for(i ...
- Sun Dec 16, 2007 10:32 pm
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies: 109
- Views: 41064
acm-543 TLE
Thanks to Jan, My answer has improved but still I m getting TLE:(.. it's not working for input 1000000..
anymore suggestion form anybody???
anymore suggestion form anybody???
- Sun Dec 16, 2007 12:01 pm
- Forum: Volume 6 (600-699)
- Topic: 612 - DNA Sorting
- Replies: 122
- Views: 33601
RE in acm612
Can anyone please tell me why I m getting RE in this program??
#include<stdio.h>
#include<string.h>
void sort(char a[][50], int m, int n)
{
int i,j,k,t,ar[100]={0};
char b[100][50],temp,c[50];
for(i=0;i<m;i++)
strcpy(b[i],a[i]);
for(k=0;k<m;k++)
for(i=0;i<(n-1);i++)
for(j=i+1;j<n;j ...
#include<stdio.h>
#include<string.h>
void sort(char a[][50], int m, int n)
{
int i,j,k,t,ar[100]={0};
char b[100][50],temp,c[50];
for(i=0;i<m;i++)
strcpy(b[i],a[i]);
for(k=0;k<m;k++)
for(i=0;i<(n-1);i++)
for(j=i+1;j<n;j ...
- Sun Dec 16, 2007 11:16 am
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies: 109
- Views: 41064
TLE in acm-543
Can any one please tell me why I m getting TLE??
and How can I use sieve in such a long number 1000000..?
[codeAC[/code]
and How can I use sieve in such a long number 1000000..?
[codeAC[/code]
- Wed Dec 12, 2007 8:40 pm
- Forum: Volume 4 (400-499)
- Topic: 406 - Prime Cuts
- Replies: 187
- Views: 60434
406
Can any one please tell why I m getting WA in acm-406......
#include<stdio.h>
#include<math.h>
int prime(int n)
{
int i;
if(n==2)
return 2;
if(n%2==0)
return 0;
for(i=3;i<=sqrt(n);i+=2)
if(n%i==0)
return 0;
return n;
}
main()
{
int i,j,a[1000],n,c,x,k,l;
while(scanf("%d %d",&n,&c ...
#include<stdio.h>
#include<math.h>
int prime(int n)
{
int i;
if(n==2)
return 2;
if(n%2==0)
return 0;
for(i=3;i<=sqrt(n);i+=2)
if(n%i==0)
return 0;
return n;
}
main()
{
int i,j,a[1000],n,c,x,k,l;
while(scanf("%d %d",&n,&c ...
- Wed Dec 05, 2007 7:28 am
- Forum: Volume 101 (10100-10199)
- Topic: 10189 - Minesweeper
- Replies: 418
- Views: 124792
acm-10189
CAN any one please tell me why I m getting CE??
#include<iostream>
using namespace std;
int check(int i, int j, int x, int y, char b[][100]);
void main(void)
{
int i,j,k=0,m,n,z;
char a[100][100];
while(1)
{
cin >> m >> n;
if(m==0&&n==0)
break;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin ...
#include<iostream>
using namespace std;
int check(int i, int j, int x, int y, char b[][100]);
void main(void)
{
int i,j,k=0,m,n,z;
char a[100][100];
while(1)
{
cin >> m >> n;
if(m==0&&n==0)
break;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin ...
- Tue Dec 04, 2007 8:34 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10213 - How Many Pieces of Land ?
- Replies: 54
- Views: 31022
acm-10213
How can I use Bigint in C++?
- Mon Dec 03, 2007 8:42 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10213 - How Many Pieces of Land ?
- Replies: 54
- Views: 31022
acm-10213
can anyone please tell me what is the prob in my following code>
what data type I should use?
#include<stdio.h>
long long f(long long n)
{
long long x=1,z,y=0;
if(n>3)
x=n*(n-1)*(n-2)*(n-3);
z=(x/24);
if(n>1)
y=((n*(n-1))/2);
return (y+z+1);
}
main()
{
long long a[3500],b[3500],s,n;
int i ...
what data type I should use?
#include<stdio.h>
long long f(long long n)
{
long long x=1,z,y=0;
if(n>3)
x=n*(n-1)*(n-2)*(n-3);
z=(x/24);
if(n>1)
y=((n*(n-1))/2);
return (y+z+1);
}
main()
{
long long a[3500],b[3500],s,n;
int i ...
- Tue Jun 05, 2007 2:48 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10929 - You can say 11
- Replies: 69
- Views: 37105