Page 3 of 4
ACC --> sample I/O
Posted: Sun Mar 13, 2005 7:34 pm
by Sedefcho
I finally got ACC on this problem. The problem was in my archive
for quite some time and finally I found some time to get
back to it.
Here is some sample I/O for anyone who might be interested.
INPUT
Code: Select all
18
0
1
54
12575
312544
808080777
110010
99999
878787878
1112143
234000243
999999999
777777777
101010101
1000000000
2000000000
1234567890
2147483647
OUTPUT
Code: Select all
1
1
317683
1041390301833851
397580508821554746073
17766744538362351421688193776113027
6102302473357942756
4166250019582975003
24849919480110185721478177782865879
63742478475498293889839
124926329720184395503853225251864
41666666250000001958333329750000003
15247929506896815534083978943771277
4337584555967507575973509760476
41666666416666667624999999250000001
666666664666666670499999998500000001
96794050695522260242568330014498846
886151993063477126682488902248300547
Posted: Sun Apr 17, 2005 3:26 am
by Antonio Ocampo
Well I got this output:
Code: Select all
1
1
317683
1041390301833851
397580508821554746073
17766744538362351421688193776113027
6102857182742934706
4166250019582975003
24849919480110185721478177782865879
63742478475498293889839
124926329720184395503853225251864
41666666250000001958333329750000003
15247929506896815534083978943771277
4337584555967507575973509760476
41666666833333332208333340083333334
666666667999999995500000013500000001
96794051479554078646053958357844896
886151993063477126682488902248300547
I don't know my mistake.
Please help me

Posted: Sun Apr 17, 2005 4:07 pm
by Sedefcho
Antonio,
You have different output than mine for
these inputs ( see the 4th, 3rd and 2nd LAST
lines from my input ).
I suggest you debug step-by-step
your program for these inputs.
And see
1) if something unusual happens while
your code gets executed
2) where exactly in your code this happens
The interesting thing is that the numbers in your output
begin with same digits as my output numbers but at some
moment a mismatch starts. You should check why is that.
Posted: Sun May 15, 2005 11:20 pm
by Antonio Ocampo
Hi Sedefcho
It was a mistake in my bigint class

At last it is fixed.
Thanks for your help
Greetings
Posted: Wed Jul 06, 2005 5:07 pm
by Hector_Hsu
Just
Ans = 1 + C(n,2) + C(n,4)
-> 1 + n*(n-1)/2 + n*(n-1)*(n-2)*(n-3)/24
------
We can observe and get it.
When n = 1 , ans = 1;
1 is the original area.
When n = 2 , ans = 2;
We have two points so get 1 line.Just add 1 more area.
When n = 3 , ans = 4;
We have three points so get 3 lines,Just add 3 more areas.
When n = 4 , ans = 8;
We have four points so get 6(C(4,2)) lines, Just add 6 more areas.
And there are two lines intersecting to form a new point in the middle.
Just Add another one area.
So we calculate the areas :
Ans = Original Area + lines + points made from lines
= 1 + C(n,2) + C(n,4)
10213
Posted: Thu Sep 08, 2005 12:22 pm
by Rocky
I Got Wrong Answer In 10213(HOW MANY PEICE OF LAND).
Can Any Body Help Me By Giving Some I/o For This Problem
Help Me Please....
THANK"S IN ADVANCE
Rocky
acc at last
Posted: Tue Sep 13, 2005 9:08 am
by Rocky
Ah.. Simple Mistake I got Acc at least
Rocky
10213 need answers to test cases
Posted: Fri Aug 04, 2006 11:02 pm
by 898989
Pleases can any one give me answers to the next cases
Code: Select all
0
1
5
7
10
100
10000
124
21533
456
79888
1048576
2147483647
Re: 10213 need answers to test cases
Posted: Thu Aug 24, 2006 5:37 am
by Martin Macko
898989 wrote:Pleases can any one give me answers to the next cases
Code: Select all
0
1
5
7
10
100
10000
124
21533
456
79888
1048576
2147483647
My AC's output:
Code: Select all
1
1
16
57
256
3926176
416416762492501
9388878
8955419035380574
1778051731
1697001927971339669
50371620921287095091201
886151993063477126682488902248300547
Re: 10213 need answers to test cases
Posted: Thu Aug 24, 2006 5:38 am
by Martin Macko
And btw, there is already a thread on this problem. If there is a thread on a particular problem, please, use it to post your question and do not create a new one. (see
http://online-judge.uva.es/board/viewtopic.php?t=3196)
forum 'Volume CII' description wrote:All about problems in Volume CII. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Posted: Thu Aug 24, 2006 5:46 am
by Martin Macko
Here you can find some more info on this sequence:
Sloane's A000127.
acm-10213
Posted: Mon Dec 03, 2007 8:42 pm
by hridoy
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;
scanf("%lld",&s);
for(i=0;i<s;i++)
scanf("%lld",&a);
for(i=0;i<s;i++)
b=f(a);
for(i=0;i<s;i++)
printf("%lld\n",b);
}
Posted: Tue Dec 04, 2007 5:25 pm
by Jan
'long long' is not enough. You should use bigint calculations for this problem.
acm-10213
Posted: Tue Dec 04, 2007 8:34 pm
by hridoy
How can I use Bigint in C++?
Posted: Tue Dec 04, 2007 8:52 pm
by Jan
Design your own Bigint class. Or you can collect it from other source. But better to make your own.