is there anything strange in the test 4?
is there anything strange in the test 1?
Re: is there anything strange in the test 1?
Послано
sloboz 28 июн 2004 18:56
test 4 has only nines as sum and the last one is ten so the previous nines become zeroes.
Re: is there anything strange in the test 1?
and the test1?
it should not be 4750 right
Re: is there anything strange in the test 1?
4
0 4
4 2
6 8
3 7
-> 4750 alright...
Re: is there anything strange in the test 1?
what's test1,i really want to know
Re: is there anything strange in the test 1?
that was test 1 :)
my prog,output 4750 but got wa in test 1,i really dont know why
#include <iostream>
#include <vector>
using namespace std;
int main()
{
long i,former,latter,n,c,count9=0;
vector<long> a(0);
cin>>n;
for(i=0;i<2*n;i++)
{
cin>>c;
a.push_back(c);
}
former=a[0]+a[1];
for(i=0;i<2*n;i+=2)
{
latter=a[i+2]+a[i+3];
if(n>=2)
{
if(latter<10)
{
if(latter==9)
{
count9++;
if(i+3==2*n-1)
{
cout<<former;
while(count9--)
cout<<9;
}
}
else if(latter!=9&&count9==0)
{
cout<<former;
former=latter;
}
else if(latter!=9&&count9>0)
{
cout<<former;
while(count9--)
cout<<9;
cout<<latter;
}
}
else
{
if(count9)
{
if(former==a[0]+a[1])
cout<<(former+1)%10;
else
cout<<former+1;
while(count9--)
cout<<0;
cout<<latter%10;
}
else
{
cout<<former+1;
former=latter%10;
}
}
}
else
cout<<former<<endl;
}
return 0;
}
Re: my prog,output 4750 but got wa in test 1,i really dont know why
Looks very strange: your program gives different answers on 1st test on different compilers! Right answer - only if compiled with C++Builder.
This trouble is also well known (+)
First time I've faced it when the student on the olympiad compiled his text with Visual C++ 6.0, and Delta Checker (my system of checking) - with C++ Builder 6.0. The answers were different. More over, this things may happen in the following cases:
- different compilers
- different operating systems (i.e. W98 and W2000)
- the hidden error in program - i.e. some kind of access violation or overflow - take it also into consideration...
Re: This trouble is also well known (+)
ft...it's really hard to imagine...
im not very familiar with such usage "vector<long> a(0);"
so wondering whether it's correct though it looks correct in my local VC++6.0
i know this sort of datas is not legal right
4
1 9
5 5
4 3
1 3
Re: This trouble is also well known (+)
Послано
dpk 11 авг 2004 11:43
4
5 4
4 5
4 5
5 5
is it output 10000?
but i also get WA at test4!
help me
quoting: "the length of their sum does not exceed N. "
Re: quoting: "the length of their sum does not exceed N. "
Is it form the first or the last?
9000+1000=0000 or 1000??
Tell me ! And what was the reason of Crash?
the problem statement says that there can be no test with correct sum being longer than N symbols (-)