Search found 85 matches

by medv
Thu Sep 16, 2004 12:06 pm
Forum: Volume 104 (10400-10499)
Topic: 10407 - Simple division
Replies: 34
Views: 11742

10407 - Wy WA?

Help me, please! Why WA??? #include <stdio.h> #include <math.h> int gcd(int a,int b) { return (a == 0) ? b: gcd(b%a, a); } void main() { int a,b,res; while(scanf("%d\n",&a),a > 0) { scanf("%d",&b); res = abs(a-b); while (scanf("%d",&b),b>0) { res = gcd(res,abs(a-b)); a = b; } scanf("\n"); printf("%d...
by medv
Wed Sep 01, 2004 11:46 pm
Forum: Volume 106 (10600-10699)
Topic: 10610 - Gopher and Hawks
Replies: 29
Views: 12795

10610 - WA! Why Dejkstra does not work???

Could smb help me? Why Dejkstra does not work??? Give me some tests! program p10610; const MAX = 1002; var g:array[0..MAX+1,0..MAX+1] of double; d,x,y:array[0..MAX+1] of double; Holes,w,v,m,i,j:integer; min,di,DIST:double; s:array[0..MAX+1] of boolean; pi:array[0..MAX+1] of integer; function minimum...
by medv
Mon Jul 19, 2004 5:49 pm
Forum: Volume 106 (10600-10699)
Topic: 10610 - Gopher and Hawks
Replies: 29
Views: 12795

So what was your mistake?

So what was your mistake?
I have also WA. Probably it will help me.
by medv
Mon Jul 12, 2004 8:02 pm
Forum: Volume 106 (10600-10699)
Topic: 10625 - GNU = GNU'sNotUnix
Replies: 16
Views: 8735

10625 - Why WA?

program p10625; const MIN = 33;MAX = 126; type row = array[MIN..MAX] of extended; var TempM,m,m1:array[MIN..MAX] of row; inp,i,j,k,tests,rules:integer; number,Left,Right:integer; ch,letter:char; s:array[MIN..MAX] of integer; res:extended; procedure copy(var a,b:array of row); var i,j:integer; begin ...
by medv
Mon Jul 12, 2004 3:36 pm
Forum: Volume 106 (10600-10699)
Topic: 10625 - GNU = GNU'sNotUnix
Replies: 16
Views: 8735

I get WA yet, but I know the Math

Hi! I built a matrix m[33..126,33..126] where m[i,j] = amount of letters with ASCII code j in a rule, beginning with a letter with ASCII code i. For example , if I had only 3 letters (A,B,C) and rules A->ABC B->BAAC C->CB then I would get matrix ((1 1 1)(2 1 1)(0 1 1)). In each query I have a Word, ...
by medv
Wed Jul 07, 2004 7:49 am
Forum: Volume 5 (500-599)
Topic: 500 - Table
Replies: 1374
Views: 22691

500 - Table

Can smb help me? Why WA? program p500; const MAX = 255; Rows = 100; var TempString,s:string; x,AmountIndex,Row,Column,Counter,i,j,k:integer; Amount,MaxLength:array[1..MAX] of integer; Table:array[1..Rows,1..MAX] of string; function GetRealString(s:String):string; var i,j:integer; begin i := 1; j := ...
by medv
Sat Apr 24, 2004 5:33 pm
Forum: Volume 106 (10600-10699)
Topic: 10623 - Thinking Backward
Replies: 13
Views: 4856

Give me a HINT!

Could you please give me a Hint?
by medv
Fri Apr 23, 2004 4:23 pm
Forum: Volume 106 (10600-10699)
Topic: 10623 - Thinking Backward
Replies: 13
Views: 4856

I found mistake, but any way WA!

I found mistake, but any way WA! My last program did not work for 32 unsigned int. And I didn't check bounds of p. WHAT ELSE? program p10623; var b,m,n,p:longint; det,s,res1,res2:extended; cs,i,j,k:longint; flag:boolean; begin cs:=0; while True do begin readln(s); flag := True; Inc(cs); if s < 0 the...
by medv
Fri Apr 23, 2004 4:02 pm
Forum: Volume 106 (10600-10699)
Topic: 10623 - Thinking Backward
Replies: 13
Views: 4856

10623 WA

m ellipses, n circles, p triangles divide plane on 2 + 2m(m-1) + n(n-1) + 4mn + 3p(p-1) + 6mp + 6np areas. Then I begin search: m=0,..,100; n = 0,...,20000. and evaluate p (solve quadratic equation). Check tripple m,n,p. And get WA! Can smb help me? program p10623; var b,m,n,p,s:longint; cs,res1,res...
by medv
Wed Apr 21, 2004 2:53 pm
Forum: Volume 106 (10600-10699)
Topic: 10623 - Thinking Backward
Replies: 13
Views: 4856

10623 - Thinking Backward

Hi everybody!

I have a formula for amount of regions. Then I do full search looking for all tripples (m, n, p). So I get TLE.

Can smb help me?
by medv
Mon Apr 05, 2004 4:06 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 26207

Thanks, I have solved at last

Thanks, I have solved at last
by medv
Sun Apr 04, 2004 7:30 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 26207

It seems all right

It seems all right
But anybody, help me!
by medv
Fri Apr 02, 2004 7:43 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 26207

195 WA Why?

Help me, please! program p195; var tests,i,j,n:integer; s:string; notfinished:boolean; procedure perest(n:integer); var i,first, second: integer; ch,temp:char; begin first := n-1; while ((s[first] >= s[first+1]) and (first > 0)) do Dec(first); if first < 1 then begin notfinished := False; Exit; end;...
by medv
Sun Mar 07, 2004 11:59 am
Forum: Volume 5 (500-599)
Topic: 531 - Compromise
Replies: 73
Views: 25474

531 - WA. Help me please!

What here wrong? program p531; const MAX = 100; var x,y:array[1..MAX] of string; lenx,leny,i:integer; s:string; b,c:array[0..MAX,0..MAX] of integer; function GetWord:string; var c:char; s:string; begin read(c); while not (c in ['a'..'z','#']) do begin read(c); if eof then Exit; end; s := ''; while c...
by medv
Wed Mar 03, 2004 12:02 pm
Forum: Algorithms
Topic: can any body inform me the best prime generating algorithm ?
Replies: 17
Views: 6135

Primes generation algorithm

I use this one: const MAX = any number you need; var primes:array[1..MAX] of boolean; procedure genprimes; var i,j:longint; begin FillChar(primes,sizeof(primes),1); for i:=2 to trunc(sqrt(MAX)) do if primes[i] then begin j:=i*i; while (j <= MAX) do begin primes[j] := False; j := j + i; end; end; pri...

Go to advanced search