I'm a cheater! :)
Bugaga! :)
I got AC!
So, it's my evil ideas:
I create array 1..236000 of cardinal - not int64!!
Longword type is good, too.
Read 1-235000 numbers and sort it.
Later I wrote this:
q:=235000;
z:=q;
repeat
for i:=1 to 1000 do
readln(a[z+i]);
sort(1,z+1000);
q:=q+1000;
until q>n;
Unkind solution. :P
And great output:
if (n mod 2)=0 then writeln(((a[n div 2]div 2)+(a[(n div 2)+1]div 2)+((a[(n div 2)]mod 2)+(a[(n div 2)+1]mod 2))div 2),'.',((a[(n div 2)+1]+a[(n div 2)])mod 2)*5 ) else writeln(a[(n div 2)+1],'.0');
So, what you say?
Re: I'm a cheater! :)
hm.. strange
Edited by author 01.04.2007 14:42
Re: I'm a cheater! :)
What strange??
How you solve this problem?
Re: I'm a cheater! :)
is it really work or
it's 1 april joke?:)
I don't understand your out
I used another way (heap)
Re: I'm a cheater! :)
No it's joke:)
ok... It's not hard to understand
((a[(n div 2)]mod 2)+(a[(n div 2)+1]mod 2))div 2 = 0 or 1
((a[(n div 2)+1]+a[(n div 2)])mod 2)*5 = 5
heh.. evil cheater:)
Edited by author 01.04.2007 20:49
Edited by author 01.04.2007 20:55
Edited by author 01.04.2007 21:57
Re: I'm a cheater! :)
If you can't beleive:
[AC code deleted by autor :)]
Edited by author 01.04.2007 20:57
Re: I'm a cheater! :)
ты нас не обманешь;)
see previous post
Re: I'm a cheater! :)
Understand? :)
So, if you do this:
(a[(n div 2)+1]+a[n div 2]) div 2
you get numeric type overflow!
It's your A1 joke? :)
Use english! (Правда я сам его почти не знаю)
Re: I'm a cheater! :)
Heh, ok. :)
I know this, $FFFFFFFF+1=$00000000.
But (3000000000+3000000000)div 2 is not 3000000000.
It's 852516352 (if you use cardinal, like me).
My shamanism (maybe shamanstvo? :)) worked correctly - answer is 3000000000.
So, what you say about this? ;)
Re: I'm a cheater! :)
I only now understand what you wrote:)
(output is long)
I'm sorry but it's simple calculations(no shamanism:)
((a[(n div 2)]mod 2)+(a[(n div 2)+1]mod 2))div 2 =
a[n shr 1]and a[n shr 1+1]and 1
may be better use int64 or real?
Edited by author 01.04.2007 22:12
Edited by author 01.04.2007 22:32
Re: I'm a cheater! :)
Don't remember! We have only 1Mb of memory.
Short real types lose accuracy.
Int64 and big reals (like double and extended) need more memory and worked so slow.
I think using int64 we can't create minimal array - 125001 numbers, but I can't check it.
Re: I'm a cheater! :)
You can assign to real or int64 type before output
writeln(((a[n div 2]div 2)+(a[(n div 2)+1]div 2)+((a[(n div 2)]mod 2)+(a[(n div 2)+1]mod 2))div 2),'.',((a[(n div 2)+1]+a[(n div 2)])mod 2)*5 );
equals to
writeln((int64(a[n div 2])+a[(n div 2)+1])/2:0:1);
Edited by author 01.04.2007 23:25
Re: I'm a cheater! :)
> writeln((int64(a[n div 2])+a[(n div 2)+1])/2:0:1);
Is it correct?
What doing function int64();? Return value, which was be counted in int64 size?
Whether exists function real();?
Re: I'm a cheater! :)
it's not function
it's type modification (приведение типа)
in this case expression will calc in int64 type
another easy way
var
n1,n2:real; //or int64
...
n1:=a[n div 2];
n2:=a[n div 2 +1];
writeln((n1+n2):0:1)
Re: I'm a cheater! :)
With LongInt
Write( A[N Div 2]/2 + A[N Div 2 +1]/2:1:1);
Re: I'm a cheater! :)
To Anatoliy: It's worked too? Fun.
To KIRILL: Yes, you is right. It's easier.