Why my code get WA???????
Here my code:
#include <iostream.h>
long long a[11][101];
int n,m;
int min(int y,int x)
{
int y1=y-1,y2=y+1;
if (y1==0) y1=m;if (y2==m+1) y2=1;
if (a[y1][x]<=a[y][x]&&a[y1][x]<=a[y2][x]) return y1;
else if (a[y][x]<=a[y2][x]&&a[y][x]<=a[y1][x]) return y;
else ...
Search found 16 matches
- Thu Mar 24, 2005 10:55 am
- Forum: Volume 1 (100-199)
- Topic: 116 - Unidirectional TSP
- Replies: 226
- Views: 65230
- Thu Mar 24, 2005 10:40 am
- Forum: Volume 1 (100-199)
- Topic: 116 - Unidirectional TSP
- Replies: 226
- Views: 65230
!
My C++ code outputs same answers about the set of input
I also get WA! I don't understand why???
Code: Select all
8
-1
1 1 1 1 1 1 1 1 1 1
-10
1 5
2
2 1 2 1 2
2
1
-7
1 1 6 5 4 3
8
2 3 4 5 4 3
7
1 1 1 1 6 5
10
1 1 1 1 1 1 1 1 1 1
1073741823
- Wed Mar 23, 2005 7:03 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10832 - Yoyodyne
- Replies: 6
- Views: 3656
- Wed Mar 23, 2005 4:15 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10832 - Yoyodyne
- Replies: 6
- Views: 3656
!
I don't understand this sentence, please say this in other words!!The next buoy to visit is determined by the closest buoy in the mission that has not yet been visited. In case of a tie, the buoy information that comes first in the input is given preference.

Thank you!!!
- Wed Mar 23, 2005 2:48 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10830 - A New Function
- Replies: 33
- Views: 19029
I change line
to line
And got AC!!!
Thank's Emilio !!
And others!!
Sorry for my English!!!
Code: Select all
long n,t,i,s=0;
Code: Select all
long long n,t,i,s=0;
Thank's Emilio !!
And others!!
Sorry for my English!!!

- Wed Mar 23, 2005 11:45 am
- Forum: Volume 108 (10800-10899)
- Topic: 10832 - Yoyodyne
- Replies: 6
- Views: 3656
- Wed Mar 23, 2005 11:13 am
- Forum: Volume 108 (10800-10899)
- Topic: 10830 - A New Function
- Replies: 33
- Views: 19029
WHY WA?
For this input
I get this output:
I think it's right, isn't it???
Code: Select all
1
2
3
4
5
6
7
8
9
10
0
Code: Select all
Case 1: 0
Case 2: 0
Case 3: 0
Case 4: 2
Case 5: 2
Case 6: 7
Case 7: 7
Case 8: 13
Case 9: 16
Case 10: 23
- Wed Mar 23, 2005 9:28 am
- Forum: Volume 108 (10800-10899)
- Topic: 10832 - Yoyodyne
- Replies: 6
- Views: 3656
10832 - Yoyodyne
Please HELP!!!!



- Tue Mar 22, 2005 10:32 pm
- Forum: Volume 1 (100-199)
- Topic: 116 - Unidirectional TSP
- Replies: 226
- Views: 65230
Help!! Problem 116!! Critical i/o!!
For the input
12 14
1 2 2 1 1 1 1 1 1 1 1 1 1 2
1 1 2 2 1 1 1 1 1 1 1 1 1 1
1 1 1 2 2 1 1 1 1 1 1 1 1 1
1 1 1 1 2 2 1 1 1 1 1 1 1 1
1 1 1 1 1 2 2 1 1 1 1 1 1 1
1 1 1 1 1 1 2 2 1 1 1 1 1 1
1 1 1 1 1 1 1 2 2 1 1 1 1 1
1 1 1 1 1 1 1 1 2 2 1 1 1 1
1 1 1 1 1 1 1 1 1 2 2 1 1 1
1 1 1 1 1 1 1 1 ...
12 14
1 2 2 1 1 1 1 1 1 1 1 1 1 2
1 1 2 2 1 1 1 1 1 1 1 1 1 1
1 1 1 2 2 1 1 1 1 1 1 1 1 1
1 1 1 1 2 2 1 1 1 1 1 1 1 1
1 1 1 1 1 2 2 1 1 1 1 1 1 1
1 1 1 1 1 1 2 2 1 1 1 1 1 1
1 1 1 1 1 1 1 2 2 1 1 1 1 1
1 1 1 1 1 1 1 1 2 2 1 1 1 1
1 1 1 1 1 1 1 1 1 2 2 1 1 1
1 1 1 1 1 1 1 1 ...
- Tue Mar 22, 2005 7:41 pm
- Forum: Volume 1 (100-199)
- Topic: 128 - Software CRC
- Replies: 62
- Views: 14549
Problem 128!!!! Software CRC!!!
I don't understand the explanation for this problem!!
Please help me!!
Sorry for my english!!

Please help me!!
Sorry for my english!!



- Mon Mar 14, 2005 8:46 am
- Forum: Volume 1 (100-199)
- Topic: 113 - Power of Cryptography
- Replies: 163
- Views: 50327
- Sun Mar 13, 2005 8:19 pm
- Forum: Volume 1 (100-199)
- Topic: 113 - Power of Cryptography
- Replies: 163
- Views: 50327
Can anybody help me?
why this code got AC
#include<stdio.h>
#include<math.h>
void main()
{
double n,p;
while(scanf("%lf %lf",&n,&p)==2)
{printf("%.lf\n",floor(pow(p,1.0/n)+0.5));}
}
And this WA
#include<iostream.h>
#include<math.h>
void main()
{
double n,p;
while(cin>>n>>p) cout<<floor(pow(p,1.0/n)+0 ...
#include<stdio.h>
#include<math.h>
void main()
{
double n,p;
while(scanf("%lf %lf",&n,&p)==2)
{printf("%.lf\n",floor(pow(p,1.0/n)+0.5));}
}
And this WA
#include<iostream.h>
#include<math.h>
void main()
{
double n,p;
while(cin>>n>>p) cout<<floor(pow(p,1.0/n)+0 ...
- Sun Mar 13, 2005 7:35 pm
- Forum: Volume 3 (300-399)
- Topic: 371 - Ackermann Functions
- Replies: 196
- Views: 51123
- Sun Mar 13, 2005 7:30 pm
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 59948
495! Please help!
i got TLE, why?
#include <iostream.h>
void main()
{
int n,a[1050],b[1050],c[1050],i,s,t;
while (cin>>n)
{
for (i=1;i<1050;i++) { a[i]=0; b[i]=0; }
a[0]=1;a[1]=1;
b[0]=1;b[1]=1;
c[0]=1;c[1]=1;
if (n==0) c[1]=0;
for (t=3;t<=n;t++)
{
s=0;
c[0]=b[0];
for (i=1;i<=c[0];i++)
{
c[i]=(a[i ...
#include <iostream.h>
void main()
{
int n,a[1050],b[1050],c[1050],i,s,t;
while (cin>>n)
{
for (i=1;i<1050;i++) { a[i]=0; b[i]=0; }
a[0]=1;a[1]=1;
b[0]=1;b[1]=1;
c[0]=1;c[1]=1;
if (n==0) c[1]=0;
for (t=3;t<=n;t++)
{
s=0;
c[0]=b[0];
for (i=1;i<=c[0];i++)
{
c[i]=(a[i ...
- Thu Mar 10, 2005 9:33 pm
- Forum: Volume 3 (300-399)
- Topic: 371 - Ackermann Functions
- Replies: 196
- Views: 51123
Please HELP! 371 WA
What's wrong in my code?
#include <iostream.h>
void main()
{
long long i,j,n,max,v,c,t,tmp;
cin>>i>>j;
while(i!=0)
{
v=-1;
max=0;
if(i>j) {tmp=j;j=i;i=tmp;}
for(t=i;t<=j;t++)
{
c=0;
n=t;
while(n!=1)
{
c++;
if(n%2==1) n=3*n+1;else n/=2;
}
if(c>max||v==-1) {max=c;v=t;}
}
cout ...
#include <iostream.h>
void main()
{
long long i,j,n,max,v,c,t,tmp;
cin>>i>>j;
while(i!=0)
{
v=-1;
max=0;
if(i>j) {tmp=j;j=i;i=tmp;}
for(t=i;t<=j;t++)
{
c=0;
n=t;
while(n!=1)
{
c++;
if(n%2==1) n=3*n+1;else n/=2;
}
if(c>max||v==-1) {max=c;v=t;}
}
cout ...