Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Has anybody tests for this problem? | Valentin Mihov | 1060. Flip Game | 3 Sep 2002 19:33 | 1 | I don't know why my program do WA!!! I tested it for hundreds test and it works for them!!! Has anybody tests for this problem? | | Why do I get WA??? | ChuanLin | 1138. Integer Percentage | 3 Sep 2002 15:33 | 1 | var ok:array[1..10000]of longint; n,s,i,j,min:longint; nf,sf,max:longint; begin fillchar(ok,sizeof(ok),0); readln(n,s); ok[s]:=1;max:=0; for i:=s to n-1 do begin if i*2>=n then min:=n else min:=i*2; for j:=i+1 to min do if (ok[i]+1>ok[j])and(j*100 mod i=0) then ok[j]:=ok[i]+1; if max<ok[i] then max:=ok[i]; end; writeln(max); end. | | Why i get WA? Can anyone tell me why? | Matei Alexandru | 1048. Superlong Sums | 3 Sep 2002 03:43 | 1 | #include <stdio.h> #include <stdlib.h> #define ONLINE_CONTEST void main() { long n; long nr; int i, x, y, ant, first = 1; #ifndef ONLINE_CONTEST freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif scanf("%ld", &n); nr = 0; for(i = 0; i < n; i++) { scanf("%d%d", &x, &y); x = x + y; if(first) { first = 0; ant = x; } else if(x < 9) { printf("%d", ant); for(y = 0; y < nr;y++) { printf("9"); } ant = x; nr=0; } else if(x == 9) { nr++; } else if(x > 9) { printf("%d", ant+1); for(y = 0; y < nr; y++) { printf("0"); } ant = x % 10; nr = 0; } } if(!first) printf("%d", ant); } | | sultan | 1031. Railway Tickets | 2 Sep 2002 17:32 | 1 | dear sir i am not understandin the prob clearly what is the L1,L2,L3 in the prob | | sultan | 1036. Lucky Tickets | 2 Sep 2002 01:17 | 1 | dear sir please help me out in the prob sir i am not understanding the prob what is mean by"ever ticket has its 2N-digit number". and what will be the first digit and what will be the last digit and what is mean by "the sum of all digits in the number" when we give 2 2 the answer is 4 how will u please explain me please | | help me out | sultan | 1007. Code Words | 2 Sep 2002 01:10 | 1 | dear sir please help me out here. i have got some problem and plese do help me to find it out its prob if the length of each word is 4 1101 the answer is 1001 cos mod of 5 is =0; in 11011 why not the answer 1001 cos it is also the muntiple of N and why not the answer of 1101 is 1111 cos bit 1 in the third position has been changed to 0 after passing throught the noise. and please sir let me know about the answers of the followring and please explain why? 1)10011 2)110111 3)00110 4)1111 THE LENGTH OF ALL THESE IS 4 | | Help Meeeeeee! What the hell's wrong????????? | Vladislav | 1008. Image Encoding | 1 Sep 2002 16:27 | 1 | Can you correct my mistake please!!!!!! var m : Array[-10..20,-10..20] of 0..1; i,j,k,n,a,b : INTEGER; Flag : Boolean; e : array[1..100] of record x,y : integer; end; procedure work; var z,l,index,beg,en : integer; begin index := 1; beg := 1; en := 1; e[1].x:=a; e[1].y:=b; m[a,b]:=0; for j:=1 to n do begin for i:=beg to en do begin if m[e[i].x,e[i].y+1] = 1 then begin m[e[i].x,e[i].y+1] := 0; inc(index); e[index]:=e[i]; inc(e[index].y); write('R'); end; if m[e[i].x+1,e[i].y] = 1 then begin m[e[i].x+1,e[i].y] := 0; inc(index); e[index]:=e[i]; inc(e[index].x); write('B'); end; if m[e[i].x,e[i].y-1] = 1 then begin m[e[i].x,e[i].y-1] := 0; inc(index); e[index]:=e[i]; dec(e[index].y); write('L'); end; if m[e[i].x-1,e[i].y] = 1 then begin m[e[i].x-1,e[i].y] := 0; inc(index); e[index]:=e[i]; dec(e[index].x); write('T'); end; if i <> index then writeln(',') else writeln('.'); end; beg := en + 1; en := index; end; end; begin readln(n); for i:= 1 to n do begin readln(j,k); m[10-k+1,j]:=1; end; { Tursene na nai dolen lqv element } Flag := False; for i := 1 to 10 do if Flag then break else for j:= 10 downto 1 do if m[j,i] = 1 then begin Flag := True; a:=j; b:=i; Break end; { ... } work; end. | | Is anyone here from Varna? | Leonid Volkov | | 30 Aug 2002 15:35 | 3 | Hallo all, there might be some people from Varna, Bulgaria here - as far as I know - there should be some. I gonna be there (ok, not in Varna, at Zlatni Piascy, of course) for the two weeks starting from August, 23. It might be a good idea to meet somebody there - just for conversation. I could also give some lecture - as an ACM-veteran and contest organizer :-) HI! I am from Shoumen - it is not very close to Varna but...(80 km). Slavi Marinov is from varna...I don't know if there are any other.. > Hallo all, > there might be some people from Varna, Bulgaria here - as far as I > know - there should be some. I gonna be there (ok, not in Varna, at > Zlatni Piascy, of course) for the two weeks starting from August, 23. > It might be a good idea to meet somebody there - just for > conversation. I could also give some lecture - as an ACM-veteran and > contest organizer :-) | | How can I pass the time limit ? Please help me !!! | Nguyen Viet Bang | 1013. K-based Numbers. Version 3 | 27 Aug 2002 18:03 | 3 | The algorithms I found requires O(N^2) , which N = 1800 . But we must calculate the large-number ( I use string) , so it takes about O (N^3) !!! . Could anyone help me on this Problem ? There is O(N) algorithm based on formula: f(n)=(k-1)*(f(n-2)+f(n-1)). 1 Don't use string, use int array. 2 use larger base to reduce the total operation 3 if C++, don't use STL | | I check my program for all test. Answers is equal! But I got WA! What Wrong?? | hidden_u | 1067. Disk Tree | 27 Aug 2002 15:29 | 1 | var a:array[0..500]of string[85]; N,i,j,k,num,p:integer; procedure conv(i,j:integer;var num,p:integer); var k:integer; begin { if a[i]=a[j] then begin p:=length(a[i])+1; num:=0; end;} num:=0;p:=1; k:=0; for k:=1 to length(a[i]) do begin if a[i,k]<>a[j,k] then break else if a[i,k]=' ' then begin inc(num); p:=k+1; end; end; if (a[i,k]=a[j,k])and(k<>0)and((length(a[j])=length(a[i]))or(a [j,k+1] = ' ')) then begin inc(num); p:=k+2; end; end; procedure sort(l,r: longint); var i,j: longint; x,y: string[85]; begin i:=l;j:=r;x:=a[(l+r) div 2]; repeat while a[i]<x do inc(i); while x<a[j] do dec(j); if not(i>j) then begin y:=a[i]; a[i]:=a[j]; a[j]:=y; inc(i); j:=j-1; end; until i>j; if l<j then sort(l,j); if i<r then sort(i,r); end; begin { assign(input,'disktree.in'); reset(input); assign(output,'disktree.out'); rewrite(output);} readln(n); for i:=1 to N do begin readln(a[i]); for j:=1 to length(a[i]) do if a[i,j] = '\' then a[i,j]:=' '; end; sort(1,N); for i:=1 to N do begin if a[i-1]=a[i] then continue; conv(i-1,i,num,p); for k:=1 to num do write(' '); for j:=p to length(a[i]) do begin if a[i,j]=' ' then begin inc(num); writeln; for k:=1 to num do write(' '); end else write(a[i,j]); end; writeln; end; { close(output);} end. | | just wondering:can v solve this pb using the 18-based number? | #include <everything.h> | 1048. Superlong Sums | 22 Aug 2002 19:54 | 1 | just another(wrong) idea? | | HELP ME IN 1003!THANK YOU | roy | 1003. Parity | 22 Aug 2002 14:58 | 1 | why do the Memory usage is always -8. Even in such an experiment, I got Time Limit Exceeded and the Memory usage was -8. ********************************************* #include <iostream.h> typedef struct node1 {int start; int end; char mark[10]; }node; int main() { node ku[100]; int i; int n; short maxs; cin>>maxs>>n; while(n!=-1){ for(i=1;i<=n;i++){ cin>>ku[i].start>>ku[i].end; cin>>ku[i].mark; } cin>>n; } cout<<n; return 1; } **************************************** | | what's mean "Crash (ACCESS_VIOLATION)",SOS,3Q!! | procboy | | 22 Aug 2002 13:31 | 1 | | | what if --> (* xxxxxxxxx and '\r' *) ?? (+) | #include <everything.h> | 1027. D++ Again | 22 Aug 2002 10:47 | 1 | if the'\r' appears does it mean it start from the beginning of the line again? i mean : "(*xxxxxx '\r'*) "---> " *)" isn't it? if the above one is true, what will b the output for this one ( '\r'(1+2) i mean i've found space after '(' so it's Invalid now right? \but when '\r' appears it start again from the begginning of the line so ' (1+2) ' replace '(' so the now it's valid??????? ** '\r'==carriege return | | To anyone, who has test cases for this problem. I need test cases. | I.J. Matrix | 1077. Travelling Tours | 22 Aug 2002 00:48 | 1 | The reason is not Wrong answer as you can think. I use recursion in my solution of this problem and get mem limit exceeded (it is stack overflow); at all test cases, that I could make, my program works successfull and I do not know what the matter. Please - if you have any test cases - post it to this webboard or to my email pflojd@yandex.ru. | | How to read until eoln is reached? If all the characters in the input are small latin letters...Please :)) | Vladimir Milenov Vasilev | | 22 Aug 2002 00:05 | 7 | How about "while not eoln do ..." if you mean pascal :) > How about "while not eoln do ..." if you mean pascal :) Maybe "do scanf("%c",&ch); while (ch!='\n');" then. I am trying to solve problem 1102 but always "time limit exceeded". So, I made my program print on stdin some stupid thing like "kuku" after each test, but again "time limit"...I don't think that the first test is so hard that my program cann't run in the time - I believe I don't stop reading the input after "\n"...so I get time limit...It happened to me on one problem - than I read the input line by line, not char by char, and got "ACCEPTED"!!! Maybe the last line of input doesn't end with '\n' but with EOF. Try this: while (scanf("%c",&ch)!=EOF && ch!='\n') do {...} > Maybe the last line of input doesn't end with '\n' but with EOF. Try > this: > while (scanf("%c",&ch)!=EOF && ch!='\n') do {...} > | | why CE here? v can't use <math.h> here? | #include <everything.h> | | 21 Aug 2002 21:07 | 1 | | | Help !!! PLEASE !!! What's wrong in my code ????????? | Romanchik Vitaly | 1036. Lucky Tickets | 21 Aug 2002 16:25 | 1 | const nmax=100; type mas=array[1..nmax]of longint; var aa:array[0..500]of mas; i:longint; s:longint; n:longint; m,j:longint; a,b,c:mas; function dlina(a:mas):longint; var i:longint; begin i:=nmax; while a[i]=0 do dec(i); dlina:=i; end; procedure slog(a,b:mas;var c:mas); var i,d1,d2,max:longint; begin fillchar(c,sizeof(c),0); d1:=dlina(a);d2:=dlina(b); if d1>d2 then max:=d1 else max:=d2; for i:=1 to max do begin c[i]:=c[i]+a[i]+b[i]; if c[i]>9 then begin c[i+1]:=c[i] div 10; c[i]:=c[i] mod 10; end; end; end; procedure umn(a:mas;var c:mas); var i,j,p,z,d:longint; begin d:=dlina(a); fillchar(c,sizeof(c),0); for i:=1 to d do begin p:=0; for j:=1 to d do begin z:=a[i]*a[j]+p+c[i+j-1]; c[i+j-1]:=z mod 10; p:=z div 10; end; c[i+j]:=p; end; end; begin readln(n,s); if (s div 2>n*9)or(odd(n)) then begin writeln(0); halt; end; if n=1 then begin if s>9 then writeln(0)else writeln(1); halt; end; s:=s div 2; aa[0][1]:=1; for i:=1 to n do begin if s>9*i then m:=0 else m:=s; for j:=1 to m do begin slog(aa[j-1],aa[j],c); aa[j]:=c; end; end; umn(aa[m],c); for i:=dlina(c)downto 1 do write(c[i]); writeln; end. | | Compilation error | Stefan Ciobaca | 1017. Staircases | 21 Aug 2002 14:14 | 3 | When I submit the solution for the problem I get a compilation error. The error reads: "You tried to solve problem 1017. Your solution on C++ was compiled with the following errors: 143733 temp\143733(54) : error C2471: cannot update program database 'e:\judge\vc60.pdb'" can anyone tell me what is this about. I am sure the problem is correctly solved and that it does no illegal operations. Also it compiles perfectly under gcc for dos. I can't test it with Visual C++ but I don't use anything other than ANSI so it should be ok. I attach the source code of my program, maybe you could indicate the error. If the error is not with my source code, but with TIMUS, what should I do? #include <stdio.h> #define MAX 501 int n; double answer, d[MAX][MAX]; void solve() { int i, j, k; // d[i][j] = numarul de moduri in care se pot aranja j blocuri astfel // incat inaltzimea sa fie egazact j for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) d[i][j] = 0; d[0][0] = 1; for (i = 1; i <= n; i++) for (j = 1; j <= n && i - j >= 0; j++) { d[i][j] = 0; for (k = 0; k < j; k++) d[i][j] += d[i - j][k]; } /* for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) printf("%d ", d[i][j]); printf("\n"); }*/ for (k = 1; k < n; k++) answer += d[n][k]; } int main() { /*#ifndef ONLINE_JUDGE freopen("staircases.in", "r", stdin); freopen("staircases.out", "w", stdout); #endif*/ scanf("%d", &n); solve(); printf("%.0lf\n", answer); /*#ifndef ONLINE_JUDGE fclose(stdin); fclose(stdout); #endif*/ return 0; } I think the problem is not with my program but with the TIMUS computer. How can it be solved. The reason I say the problem is with their computer is that even when I submit a wrong simple solution: #include <stdio.h> int main() { int n; scanf("%d", &n); printf("%d", n); return 0; } i get the same result. Can anyone help me with this, please? > I think the problem is not with my program but with the TIMUS > computer. How can it be solved. The reason I say the problem is with > their computer is that even when I submit a wrong simple solution: > > #include <stdio.h> > > int main() > { > int n; > scanf("%d", &n); > printf("%d", n); > return 0; > } > > i get the same result. > Can anyone help me with this, please? > in C++ it is right,but in C it will get Compilation error | | SEE THE PROBLEMS | sultan | 1134. Cards | 20 Aug 2002 17:46 | 2 | what will be the answer of the following and please let me know why 1) 1 2 -1 3 2) 1 2 0 4 3) -1 -2 3 0 Hi! This problem is not very hard, if you understand it. So, the cards are numerated in this way: the first card has 0 and 1 on it's two sides, the second has 1 and 2, the third has 2 and 3...and so on..the n-th card has n-1 and n on its both sides - all the numbers are positive!!!! So, the your first and third tests are incorect - such an input will not ocure, and the answer for the second is YES, because: First NICK has taken the second card(with numbers 1 and 2), after that the third card(with numbers 2 and 3), after that the first card (with numbers 0 and 1) and on the end the forth card(with numbers 4 and 5). See that he says one of the two numbers writen on the card and each card is taken no more than once! I hope, this will help :) Bye! from Vlado |
|
|