Common Boardn = 4 answer : 4 2 1 2 2 1 4 2 2 3 2 3 4 no. 1 2 & 3 4 does not have a common color my opinion answer: 4 3 1 2 3 3 1 2 4 3 1 3 4 3 2 3 4 The right answer for n=4 is k=3 3 3 1 2 3 3 1 2 4 2 3 4 Previous answer << 4 3 1 2 3 3 1 2 4 3 1 3 4 3 2 3 4 >> is wrong because the 1st colour is used 3 times. Because my proposed answer is k=3, so the answer in problemset is right. Authors did not use the 4th colour because they can make 3 flags with 3 colours. It is only their choice. Smilodon_am, MegaThanks You! ЗЫ: коварное условие :) PS: insidious conditions :) "he doesn't want any colour to occur in three or more flags" read whole problem ;) if from t to s is possible then result=1 else result=-1 use Adjacency List to express the graph The sample output is wrong, it should be : 4 3 1 2 3 3 2 1 4 3 1 3 4 3 2 3 4 You are wrong! Color 3 is in 3 flags. Why aren't they are: 4 2 1 2 2 1 4 2 2 3 2 3 4 Read the task attentively. The 1st and 4th flag have no common color. Can't it be: 4 2 1 4 2 1 3 2 2 3 2 2 4 ??? Edited by author 14.03.2009 14:13 Sorry understood my mistake No, becouse any two flags must have one joint colour. So flags 1 4 and 2 3 are incorrect. Edited by author 14.03.2009 14:08 For Example: 3 2 1 2 3 1 3 4 3 2 3 4 #include<iostream> using namespace std; int main() { int n,k,m,b; cin>>m; cin>>k; cin>>n; b=m+k+n; cout<<b; return 0; } Люди как я понял у нас в этой задаче надо найт и кол-во комбинаций?!! 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, ...) . #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. why is it 8? Maxim Dvoynishnikov (Dnipropetrovsk SU) Re: * // Problem 1607. Taxi 14 Mar 2009 02:39 >> 1 << 10 >> 5 << 8 >> 9, but 8 370 371 199999 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 11 370 and 371 5 22 8 4 3 2 for 199999 7 463 32 10 5 4 3 2 Why I got wa 7?????? for 1999999 what answer 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 Edited by author 14.03.2009 00:58 var a,b:integer; begin read(a,b); write(a+b); end. 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 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! When I submit a solution it only writes accepted or not accepted, but where can I see how many test samples worked? 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 ... Edited by author 12.03.2009 23:22 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 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 //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 |
|