| Show all threads Hide all threads Show all messages Hide all messages |
| task is improper | allaksus | 1677. Monkey at the Keyboard | 14 Mar 2009 12:18 | 9 |
I cannot understand how much probability. If probability equal 1, answer in infinity. Edited by author 09.03.2009 09:02 You don't have the right to call the problem improper only because you don't understand it!!! Maybe read the statement more carefully and find out what is the expected time in mathematics. I think I understend task well and how decide it if we don't think about probability. If we have {2,"ba"} I find the solve is 4.6(6). But monkey can push "bbbbbb" with probability>0. You can answer me to allaksus@rambler.ru . Actually the probability of typing "bbbbbb..." (infinity times) is 0 although this can happen! And the answer to {2,"ba"} is exactly 4. Sorry, I agree with you =4 (I found one error), but the probability this event is 0.6875 . Why it isn't 0.999 or 0.99999.
If I will be audietorium I will be intrest how many maximum time I must wait with probability 0.99 You mustn't find the maximum time but the EXPECTED time, which is equal to 1*P(1) + 2*P(2) + 3*P(3) + 4*P(4) + ... P(i) is the probability of the situation, where the first appearance of the required word ends at position i. I don't know how to explain it more clearly. Edited by author 14.03.2009 01:42 The task doesn't say about condition (EXPECTED time, maximum time, ...) . |
| Wa#14...Please help.Here is code: | Search | 1607. Taxi | 14 Mar 2009 02:39 | 5 |
#include<iostream.h> #include<math.h> int main() { int a1,b1,a2,b2; cin>>a1>>b1>>a2>>b2; if(a2<=a1) cout<<a1; else if(abs(a1-a2)<b1) cout<<a2; else{ while(a1<a2) { a1+=b1; a2-=b2; } if(a1>a2) cout<<a1; else cout<<a2; } return 0; } Where I'm wrong?Please help!Thank in advance!!! For test "1 4 10 2" right answer is 8. Re: * Plamen_Iliev 5 Apr 2008 19:45 Re: * haoranlin 13 Mar 2009 10:42 Re: * Maxim Dvoynishnikov (Dnipropetrovsk SU) 14 Mar 2009 02:39 >> 1 << 10 >> 5 << 8 >> 9, but 8 |
| what answer for | +FAMAS+ | 1324. Extra Spaces | 14 Mar 2009 02:16 | 6 |
For 370 and 371: 5 21 6 3 2 2 For 199999: 7 26796 231 21 6 3 2 2 Edited by author 21.08.2005 21:06 and for. Anatoliy 'Tolyan_NO' Tolstobroff 21 Aug 2005 21:24 My output. Anatoliy 'Tolyan_NO' Tolstobroff 21 Aug 2005 21:29 370 and 371 5 22 8 4 3 2 for 199999 7 463 32 10 5 4 3 2 Why I got wa 7?????? 7 26?96 231 21 6 3 2 2 Edited by author 14.03.2009 02:17 Edited by author 14.03.2009 02:20 |
| about std:set | [neUSU]And_IV | 1069. Prufer Code | 14 Mar 2009 00:56 | 1 |
Edited by author 14.03.2009 00:58 |
| a+b | Sahil | 1000. A+B Problem | 13 Mar 2009 23:15 | 2 |
a+b Sahil 10 Nov 2008 01:14 var a,b:integer; begin read(a,b); write(a+b); end. |
| Some Help | PersonalJesus | 1348. Goat in the Garden 2 | 13 Mar 2009 19:44 | 2 |
Don't forget to use abs.. It really gave me some headaches why I receive WA#2 :) yes,yes=) thank you) But now i got WA#3 =( whats wrong? program lam; var xa,ya,xb,yb,xc,yc,ab,bc,ac,res,sk1,sk2,l,max,min: real; begin read(xa,ya,xb,yb,xc,yc,l); ab:=sqrt(sqr(xa-xb)+sqr(ya-yb)); ac:=sqrt(sqr(xa-xc)+sqr(ya-yc)); bc:=sqrt(sqr(xc-xb)+sqr(yc-yb)); sk1:=((xc-xb)*(xa-xb)+(yc-yb)*(ya-yb)); sk2:=((xc-xa)*(xb-xa)+(yc-ya)*(yb-ya)); if ab=0 then begin if l>ac then begin writeln('0.00'); writeln('0.00'); end else begin writeln((ac-l):0:2); writeln((ac-l):0:2); end; halt; end; if (sk1>0) and (sk2>0) then begin res:=abs((abs(xc-xb)*abs(ya-yb)-abs(xa-xb)*abs(yc-yb)))/ab; if l>res then writeln('0.00') else writeln((res-l):0:2); if bc>ac then max:=bc else max:=ac; if l>max then writeln('0.00') else writeln((max-l):0:2); end; if (sk1<0) or (sk2<0) then begin if bc>ac then begin max:=bc; min:=ac; end else begin max:=ac; min:=bc; end; if l>min then writeln('0.00') else writeln((min-l):0:2); if l>max then writeln('0.00') else writeln((max-l):0:2); end; if (sk1=0) or (sk2=0) then begin res:=(abs(xc-xb)*abs(ya-yb)-abs(xa-xb)*abs(yc-yb))/ab; if l>res then writeln('0.00') else writeln((res-l):0:2); if bc=res then if l>ac then writeln('0.00') else writeln((ac-l):0:2); if ac=res then if l>bc then writeln('0.00') else writeln((bc-l):0:2); end; end. Edited by author 13.03.2009 20:01 |
| who can help me ? | xiaowentao99 | 1068. Sum | 13 Mar 2009 18:54 | 3 |
my cpp file #include <stdio.h> int main(){ int num; int answer; scanf("%d",&num); if(num>=0){ for(;num>=1;num--) answer += num; } else{ for(;num<=-2;num++) answer += num; } printf("%d\n",answer); return 0; } where is the wrong ? 1) int answer; // wrong int answer = 0; // right 2) for 0 answer is 1, not 0 thank you ! I have known where is wrong .thank you all the same! |
| Submit The Solution | Angelwarrior | | 13 Mar 2009 16:29 | 1 |
When I submit a solution it only writes accepted or not accepted, but where can I see how many test samples worked? |
| question about task | Flamingdaze | 1023. Buttons | 13 Mar 2009 13:44 | 3 |
why L dont equal simply K-1? second player win at his move(1st player took >=1 stone so in heap left <=K-1=L stone). and 2<=K-1<K. Describe whats wrong in my understanding of task please. Edited by author 11.03.2009 21:13 Edited by author 11.03.2009 21:14 Edited by author 11.03.2009 21:14 ... If there are several those numbers L, you should write the least ... |
| if input is 121 v should output '-1' not '1111' ,right? | ss | 1014. Product of Digits | 12 Mar 2009 23:19 | 2 |
Edited by author 12.03.2009 23:22 |
| What do you think about... | TUSUR_lxn | 1619. Big Brother | 12 Mar 2009 17:56 | 1 |
if k < m return 0 else amount of 'good' results is equal to С(m), wher C() - Catalanas number amount of 'bad' results is equal to sum(i = 0.. m, C(i)) for example for m = 3 ( - big brother acts ) - smal brothers acts good results are (independent of k) ((())) (()()) (())() ()(()) ()()() bad results are (()) ) ()() ) () ) ) now we should calculate C(m) / sum(i = 0.. m, C(i)) C(m) / sum(i = 0.. m, C(i)) = 1 / (sum(i = 0.. m, C(i)) / C(m)) = = 1 / sum(i = 0.. m, C(i) / C(m)) = = 1 / sum( i = 0.. m, exp(ln(C(i)) - ln(C(m))) ) We can calculate ln(C(i)) using formula C(i) = F(2 * i) / F(i) / (i + 1), where F(N) = N! ln(C(i)) = ln(F(2 * i)) - ln(F(i)) - ln(i + 1) ln(F(i)) = sum(j = 1.. i, ln(j)) now we can calculate sum( i = 0.. m, exp(ln(C(i)) - ln(C(m))) ) accurate to some EPS, and can calculate answer for the task with some EPS. I tryed to pass this algo, and it doesn't take AC. Does it wrang algorithm? or it is not enought accurate? Edited by author 12.03.2009 17:59 |
| Why is the answer 9? | k_dmitry | 1003. Parity | 12 Mar 2009 16:36 | 2 |
Here is the test, i took it from ceoi99 web-page, and they say that right answer is 9. I can't understand why. -- 1000000000 10 1 100000000 even 100000001 200000000 even 200000001 300000000 even 300000001 400000000 even 400000001 500000000 even 1 500000000 even 1 1000000000 odd 100010001 200200000 odd 200000001 404000000 even 1 404000000 odd Edited by author 04.03.2008 00:41 1 100000000+100000001 200000000+200000001 404000000=1 404000000 But even+even+even<>odd |
| WA_1_(%lld) | Gubarev Valentin (Pskov) | 1688. Team.GOV! | 12 Mar 2009 16:32 | 2 |
//AC #include<iostream> using namespace std; long long n;//Плата за выход long long m;//Кол-во походов long long sum;//Сколько заплачено в ресторане long long x; int main(){ cin>>n>>m;//scanf("%lld%lld",&n,&m); n*=3; int i=0; while(i<m){ ++i; cin>>x;//scanf("%lld",&x); sum+=x; if(sum>n)break; } if(sum>n) printf("Free after %d times.",i); else printf("Team.GOV!"); return 0; } if sin -> scanf then WA. Way? I have exactly the same problem but i've written my code on pascal. Maybe there are some wrong end-of-line's in the test data. On my home computer everything works right and i'm sure that my solution is right. My solution had a silly bug: i wrote "Free after x times" without period (".") Edited by author 12.03.2009 16:46 |
| help me | hhh | 1081. Binary Lexicographic Sequence | 12 Mar 2009 16:10 | 1 |
#include <iostream> using namespace std; long long n,k,a[45],i=0,b[50],j,t=0,r=0,z,c[50]; int main() { cin>>n>>k; a[0]=1; a[1]=2; t=n; for(i=2; i<=n; i++) a[i]=a[i-1]+a[i-2]; if(k>a[n]) { z=-1; cout<<z; return 0; } else{ b[1]=b[2]=0; b[3]=1; b[4]=2; for(i=5; i<=n; i++) b[i]=2*b[i-1]+1; while(a[i]<=k) { i++; j=i; } for(i=1; i<=j; i++) z+=b[i]; r=k+z-1; while(r!=0) { c[t]=r%2; r/=2; t--; } for(i=1; i<=n-t; i++) c[i]=0; for(i=1; i<=n; i++) cout<<c[i]; return 0; }} wa#2 |
| Can any1 help what is wrong here??? | Swifty | 1404. Easy to Hack! | 12 Mar 2009 14:11 | 2 |
var s:string; s1:array [1..100] of char; a,b:array [1..100] of integer; i,j,n:integer; begin readln(s); n:=length(s); for i:=1 to n do a[i]:=ord(s[i])-97; for i:=n downto 2 do {24+x-26 = 17} begin b[i]:=(a[i]+26-a[i-1])mod 26; s1[i]:=chr(b[i]+97); end; s1[1]:=chr(((a[1]-5)mod 26)+97); for i:=1 to n do write(s1[i]); readln; end. WA on 4th test!!! |
| Who knows test #2??? | adilchib | 1021. Sacrament of the Sum | 12 Mar 2009 12:58 | 1 |
Please, sent me test #2!!! Edited by author 12.03.2009 13:00 Edited by author 12.03.2009 13:00 |
| whyWA#4 | pine9x | 1607. Taxi | 12 Mar 2009 09:31 | 3 |
var u1, u2, d1, d2: longint; K: real; begin readln(u1, d1, u2, d2); if u1>u2 then write(u1) else begin k:= (u2-u1)/(d1+d2); write(int(k)*d1 +u1 + d1:0:0);end; end. Check these cases 1 4 2 2 answer: 2 1 3 5 2 answer: 4 I think the answer is 5 because Petr's offer 1 + 4 = 5 driver's offer = 2 - 2 = 0 |
| why wa#7, i think everything is right | hhh | 1114. Boxes | 12 Mar 2009 01:23 | 1 |
#include <iostream> using namespace std; int main() { unsigned __int64 n,a,b,i,t=1,r=1,u=1,h=1,p=1,x,y; cin>>n>>a>>b; if((a==0)&&(b==0)) { cout<<1; return 0; } if(a>b) { x=a; y=b; } else { x=b; y=a; } if(y==0) { for(i=n+1; i<=n+x; i++) r*=i; for(i=2; i<=x; i++) t*=i; r/=t; cout<<r; return 0; } for(i=2; i<=y; i++) p*=i; for(i=y+1; i<=x; i++) h*=i; h*=p; for(i=n+1; i<=n+y; i++) t*=i; for(i=n+y+1; i<=n+x; i++) u*=i; u*=t; r=u*t/(h*p); cout<<r; return 0; } |
| How many numbers must I write there? | adilchib | 1001. Reverse Root | 11 Mar 2009 20:30 | 2 |
How many numbers must I write there? In extreme cases - up to 128K |
| Strange test | Tural Neymanov | 1506. Columns of Numbers | 11 Mar 2009 15:55 | 3 |
Is this Test correct? 4 3 1 2 3 4 >> 1 3 2 4 my AC prog. gives me that answer because 1 2 3 ___4 isn't correct 100%. {same test 16 5} Edited by author 09.04.2008 23:39 There are some numbers n and k, that there is not any correct solution. Probably your case is one of them. P.S. See my post. Re: Strange test Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM 11 Mar 2009 15:55 My AC program show : 1 3 4 2 |