Is there not any body who can see my code and find the mistakes ? I think my whole method is OK. But there can be some precision error. So I am getting WA. Please check my code and find mistakes. Thanks in advance.
[/b]
Search found 9 matches
- Tue Apr 20, 2004 4:45 am
- Forum: Volume 104 (10400-10499)
- Topic: 10436 - Cheapest way
- Replies: 18
- Views: 8815
- Sat Apr 17, 2004 2:08 am
- Forum: Volume 106 (10600-10699)
- Topic: 10602 - Editor Nottoobad
- Replies: 19
- Views: 13475
Always WA
Why I got WA.Please check my code.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct T
{
char str[105];
int value;
}s[105];
int sfunc(void const *a,void const *b)
{
T p,q;
int l1,l2;
p=*(T *)a;
q=*(T *)b;
l1=strlen(p.str);
l2=strlen(q.str);
if(p.value==q.value)
{
if(l1 ...
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct T
{
char str[105];
int value;
}s[105];
int sfunc(void const *a,void const *b)
{
T p,q;
int l1,l2;
p=*(T *)a;
q=*(T *)b;
l1=strlen(p.str);
l2=strlen(q.str);
if(p.value==q.value)
{
if(l1 ...
- Thu Apr 15, 2004 10:25 pm
- Forum: Volume 3 (300-399)
- Topic: 357 - Let Me Count The Ways
- Replies: 90
- Views: 17701
357 - Accepted
I got accepted
. I done a stupid mistake for the first case. I fixed my mistake
and got accepted.


- Thu Apr 15, 2004 10:09 pm
- Forum: Volume 3 (300-399)
- Topic: 357 - Let Me Count The Ways
- Replies: 90
- Views: 17701
357- WA
I use long long int .But why I always got wrong answer? Please see my code and find the bug.
#include<stdio.h>
int coin[10]={0,1,5,10,25,50};
long long int ways[30005][7];
void main()
{
int N,i,j;
for(i=1;i<=30000;i++) ways[i][0]=0;
for(i=1;i<=5;i++) ways[0][i]=1;
for(i=1;i<=30000;i ...
#include<stdio.h>
int coin[10]={0,1,5,10,25,50};
long long int ways[30005][7];
void main()
{
int N,i,j;
for(i=1;i<=30000;i++) ways[i][0]=0;
for(i=1;i<=5;i++) ways[0][i]=1;
for(i=1;i<=30000;i ...
- Mon Apr 12, 2004 11:11 pm
- Forum: Volume 104 (10400-10499)
- Topic: 10436 - Cheapest way
- Replies: 18
- Views: 8815
10436 - Cheapest Way - WA
I solved it using Dijkstra algorithm. But always got WA. Can some body check it or can give some critical input data?
#include <stdio.h>
#include<string.h>
#define inf 1000000000.00
#define nIL -1
#define MAX 101
int g[MAX][MAX],p[MAX],deg[MAX];
bool taken[MAX];
int path[MAX];
int n,len;
char ch ...
#include <stdio.h>
#include<string.h>
#define inf 1000000000.00
#define nIL -1
#define MAX 101
int g[MAX][MAX],p[MAX],deg[MAX];
bool taken[MAX];
int path[MAX];
int n,len;
char ch ...
- Tue Mar 30, 2004 11:34 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10610 - Gopher and Hawks
- Replies: 29
- Views: 17614
10610 - Gopher & Hawks
I use the following procedure:
1. mark all (u,v) such that gopher can go from u to v in m minutes with its speed v m/sec.
2.Then call bfs.
But get wrong ans. Is the procedure wrong?
1. mark all (u,v) such that gopher can go from u to v in m minutes with its speed v m/sec.
2.Then call bfs.
But get wrong ans. Is the procedure wrong?
- Tue Mar 30, 2004 11:08 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10125 - Sumsets
- Replies: 50
- Views: 24095
10125
Procedure:
1. Get all a+b and sorting them.
2.Find all (d-c) and find this by binary search from the above array.
But why wrong answer. PLS help.
Here is my code:
#include<stdio.h>
#include<stdlib.h>
typedef int LONG;
#define INF 2000000000
LONG arr[1005],data[1000009];
int index;
int ...
1. Get all a+b and sorting them.
2.Find all (d-c) and find this by binary search from the above array.
But why wrong answer. PLS help.
Here is my code:
#include<stdio.h>
#include<stdlib.h>
typedef int LONG;
#define INF 2000000000
LONG arr[1005],data[1000009];
int index;
int ...
- Mon Dec 08, 2003 11:46 pm
- Forum: Algorithms
- Topic: MST !!!
- Replies: 6
- Views: 6926
MST Problem
Another MST Problem of Archieve:
2515 - Networking
2515 - Networking
- Sun Dec 07, 2003 4:58 am
- Forum: Volume 105 (10500-10599)
- Topic: 10543 - Traveling Politician
- Replies: 25
- Views: 9440
Fixed Length All Pair
Try to use fixed length all pair shortest path algorithm for this problem. It will be easy then bfs.(From Corman).