## Search found 38 matches

Sat Jul 01, 2006 6:12 am
Forum: Algorithms
Topic: Eulcid Problem
Replies: 0
Views: 1272

### Eulcid Problem

Hi! Some time ago I've solved problem 10104 (Euclid Problem) by using Euclid's Extended Algorithm. The thing is that I didn't even considered the additional restrictions (|x|+|y| = minimum, x<= y if there's a tie). Recently I re-read the problem and come to wonder if the algorithm always gives a pai...
Sun Jun 11, 2006 9:14 pm
Forum: C
Topic: floats to integers
Replies: 3
Views: 4434
Hi! double floor(double x): rounds x down to the nearest integer. double ceil(double x): rounds x up to the nearest integer. double round(double x): rounds x to the nearest integer, but round halfway cases away from zero. double trunc(double x): round x to the nearest integer not larger in absolute ...
Sun Jun 11, 2006 6:40 pm
Forum: C
Topic: floats to integers
Replies: 3
Views: 4434

### floats to integers

Hi! It seems that the easiest way to change from floats to ints is by casting, but this may lead to errors. In Pascal I use round, but C lacks of a similar function. I'm currently using this function but I want to know if there's a better way. long float_to_int(double fX) { return((fX -((long) fX) <...
Tue May 16, 2006 5:37 pm
Forum: Algorithms
Topic: help with divide & conquer problem
Replies: 3
Views: 1675
Hi! Here's my code. Hope it helps! int odd(long x) { return ((x & 0x0001)!= 0); } void matrix_multiply(long aiMatrix1[][2], long aiMatrix2[][2], long aiResult[][2]) { long aiTemp[2][2]; aiTemp[0][0]= aiMatrix1[0][0]*aiMatrix2[0][0] + aiMatrix1[0][1]*aiMatrix2[1][0]; aiTemp[0][1]= aiMatrix1[0][0]*aiM...
Thu May 04, 2006 6:34 am
Forum: Algorithms
Topic: Topics for IOI/ICPC training
Replies: 3
Views: 1913
Hi! Thanks for your answer. I participed in some ICPC regionals, but as me and my coach were new at this, we learned as we went. Now I'm a coach (along with my former coach) of the OMI (Mexico Informatics Olympiad) at my state. My coach still trains teams for the ICPC (and I might join him). As what...
Wed May 03, 2006 6:24 am
Forum: Algorithms
Topic: Topics for IOI/ICPC training
Replies: 3
Views: 1913

### Topics for IOI/ICPC training

Hi! Which are good topics when training for IOI and ICPC? What topics might differ when training for each one? What "strategy" might differ when training for each one? Also, any good problem(s) for divide-and-conquer? (that don't use a common algorithm, such as binary search or convex hull finding) ...
Tue Oct 25, 2005 3:45 am
Forum: Volume 109 (10900-10999)
Topic: 10927 - Bright Lights
Replies: 26
Views: 14371
Here I define the precision. Const error= 10e-7; Here I define a point, x,y,z are coordinates, m is the slope (using 0,0 as the other point) and r is used to indicate if it's visible (1= visible, 0= not visible). Type punto= record m: extended; r,x,y,z: longint; end; I declare variables, c is for co...
Sun Oct 23, 2005 7:51 pm
Forum: Volume 109 (10900-10999)
Topic: 10927 - Bright Lights
Replies: 26
Views: 14371
I keep getting WA. I think it might be because of precision errors (I'm not very used to geometric problems). Any help appreciated. Const error= 10e-7; Type punto= record m: extended; r,x,y,z: longint; end; Var c,i,n,t: longint; p: array [1..100000] of punto; Function menor_m(a,b: punto): boolean; b...
Sun Oct 23, 2005 7:14 pm
Forum: Volume 109 (10900-10999)
Topic: 10933 - Volleyball
Replies: 15
Views: 6901
After several WA I discovered some thing that might be helpful: There are no inputs like the above 3 c b a 6 a-b: 24-19 25-24 37-23 40-11 42-12 b-a: 25-19 25-20 25-24 11-25 11-29 b-c: 25-24 25-20 25-23 25-12 25-11 c-a: 25-26 25-27 27-23 30-11 35-12 a-c: 25-19 25-20 25-23 c-b: 25-19 25-20 25-23 0 Fir...
Mon Jun 13, 2005 3:08 pm
Forum: Volume 101 (10100-10199)
Topic: 10107 - What is the Median?
Replies: 74
Views: 19893

### Thanks!

It's wierd to get an answer after almost two years! Anyway, very good answer. Thanks!

PS: I think you can change your readln(s) for only readln and it would still work (and you wouldn't need the string).
Sat Oct 23, 2004 5:43 am
Forum: Volume 104 (10400-10499)
Topic: 10431 - Normal Distribution
Replies: 13
Views: 3512
Thanks a lot! I would never thought of that!
Tue Mar 09, 2004 4:59 pm
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 38043
Could someone check my code? Thanks!
Tue Mar 02, 2004 10:17 pm
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 38043
Can someone check my code? [pascal] Var c,f,i,l,n,p,q,t: byte; a: array [1..100,1..100] of boolean; Procedure visita(v: byte); var j: byte; begin for j:= 1 to n do if not a[v,j] then begin a[v,j]:= true; Inc(t); visita(j); end; if (t>l) or ((t=l) and (v<f)) then begin l:= t; f:= v; end; Dec(t); end;...
Sat Jan 24, 2004 4:32 am
Forum: Volume 6 (600-699)
Topic: 686 - Goldbach's Conjecture (II)
Replies: 41
Views: 19453
Thanks a lot! I finally got AC!

The funny thing is that I got AC on the other Golbach problem and it had the same mistake.

By the way, my name is Pier, not Per. (I think you might confused my name with Per Austrin, or maybe it's just a typo).
Thu Jan 22, 2004 2:52 am
Forum: Volume 6 (600-699)
Topic: 686 - Goldbach's Conjecture (II)
Replies: 41
Views: 19453
Could some give me some test, please?