Common BoardI have error in 11 test anybody can say what is 11 test? k:=length(s)-1; if(n mod k)=0 then t:=k else t:=n mod k; p:=1; repeat p:=p*n; n:=n-k; until(n<t) Edited by author 31.01.2012 15:35 Your must be min*10 + 9 Thanks! Sorry for my small intellegence)))) First I thought it was precision but now I don't know anymore. I thought i would never post a thread like this one but... this is a part of my code, f_x() is P(x): left1 = left2 = f_x(0); for(x = 1e-3 ; x < 6000 ; x += 1e-3) { y1 = f_x(+ x); y2 = f_x(- x); ans += ((((left1 + y1)/left1)/y1)) + ((((y2 + left2)/y2)/left2)); left1 = y1; left2 = y2; } ans *= 0.5*(1e-3); Try to use dx and limits which can be represented in binary form exactly (e.g. 1/1024.0 instead of 1e-3) appreciate the tip, but still WA11... Why are you using plus-minus 6000 as limits? 1/P(x) could have its maximum as far as x = 10^6 and a bit further. Edited by author 06.12.2008 22:36 nvm, Accepted! Edited by author 02.06.2009 14:16 Thank you a lot, I AC!!!!!!!!!!!!!! INPUT: a\b d\a cc\e e\d OTHERWISE,does it have any special situations ? The output should be: a b cc e d a e d I don't think so. But you should take care not to repeat entries, like in this situation: input: a/b a output: a b and NOT: a b a type Ttree=^atree; atree=record name:string; son:Ttree; same:Ttree; end; var tree:Ttree; i,j,k,n:integer; p:Ttree; s:string; procedure create(s:string;var p:Ttree); var t,q:ttree; ss:string; begin if s='' then exit; new(q);q^.name:=''; q^.same:=nil; q^.son:=nil; ss:=copy(s,1,pos('\',s)-1); delete(s,1,pos('\',s)); if p=nil then begin q^.name:=ss; create(s,q^.son); p:=q; p^.same:=p; end else begin t:=p; while (p^.name<ss)and(p^.same<>t)and(p^.same^.name<=ss) do p:=p^.same; if p^.name=ss then create(s,p^.son) else begin q^.name:=ss; create(s,q^.son); q^.same:=p^.same; p^.same:=q; end; end; while p^.same^.name>p^.name do p:=p^.same; while p^.same^.name<p^.name do p:=p^.same; end; procedure print(i:integer;q:Ttree); var t:ttree; begin t:=q; repeat writeln(' ':i+1,q^.name); if q^.son<>nil then print(i+1,q^.son); q:=q^.same; until q=t; end; begin tree:=nil; readln(n); for i:=1 to n do begin readln(s); create(s+'\',tree); end; print(0,tree); end. Program disktree; const max=500; var a:array[1..max] of string[100]; n:integer; procedure init; var i,j:integer; begin 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]:=#1; end; end; procedure mendheap(i,now:integer); var t:integer; st:string[80]; begin while i shl 1<=now do begin if i shl 1=now then t:=now else if a[i shl 1]>a[i shl 1+1] then t:=i shl 1 else t:=i shl 1+1; if a[i]<a[t] then begin st:=a[i]; a[i]:=a[t]; a[t]:=st; i:=t; end else i:=now; end; end; procedure dothing; var i:integer; st:string[80]; begin for i:=n shr 1 downto 1 do mendheap(i,n); for i:=n-1 downto 2 do begin st:=a[1]; a[1]:=a[i+1]; a[i+1]:=st; mendheap(1,i); end; st:=a[1]; a[1]:=a[2]; a[2]:=st; end; procedure print; var i,j,t,t1:integer; s,s1,s2,st:string; begin s:=#0#0; for i:=1 to n do begin st:=a[i]; if s=copy(st,1,length(s)) then begin t:=1; for j:=1 to length(s) do if s[j]=#1 then inc(t); end else begin j:=1; t:=0; while st[j]=s[j] do begin if st[j]=#1 then inc(t); inc(j); end; end; j:=1; t1:=t; while t1>0 do begin if st[j]=#1 then dec(t1); inc(j); end; s:=st; st:=st+#1; delete(st,1,j-1); while st>'' do begin if t>0 then write(' ':t); j:=pos(#1,st); writeln(copy(st,1,j-1)); inc(t); delete(st,1,j); end; end; end; Begin init; dothing; print; End. #include<stdio.h> void A(int i) { int n; for(n=1;n<i;n++) printf("sin(%d+",n); printf("sin(%d",i); for(n=1;n<=i;n++) printf(")"); } void S(int i) { int n; for(n=1;n<i;n++) printf("("); for(n=1;n<i;n++) { A(n); printf("+%d)",i-n+1); } A(i); printf("+1"); } main() { int n; scanf("%d",&n); S(n); } >Hei, it is OK your pogram, just have a look at the sample output - you have to change the sign "+" and "-" - your program outputs just sign "+" - you have to change the sign each time - that is it. I think, you will get accepted - TRY IT!!!!! Thank you for your information.But I still misunderstand your meaning Please explain more details Thanks Again!!! As I saw our program, you for n=3 your putput is: ((sin(1)+3)sin(1+sin(2))+2)sin(1+sin(2+sin(3)))+1 But have a look at the sample putput - it is: ((sin(1)+3)sin(1-sin(2))+2)sin(1-sin(2+sin(3)))+1 The signs "+" and "-" !!! Your program outputs just "+"!!!!!! TEst your program and the sample outout - you'l see! If you haven't anderstood me,write me again... Bye! > I am always wrong Sounds like a logical fallacy, lol :D "i'm lying" Just change 5th line from printf("sin(%d+",n); to printf("sin(%d%c", n, n & 1 ? '-' : '+'); for n = 1, k
the answer is : k while many programs give: k-1 but there is no such test data New tests were added. After rejudge 26 authors lost AC. You should print lexicographically kth sequence for length n like for n=3 we have, 000 -- 1st 001 -- 2nd 010 -- 3rd 100 -- 4th 101 -- 5th and for n=4 0000 - 1 0001 - 2 0010 - 3 0100 - 4 and so on.. you find kth sequence for length n :) Hope it helps > :) If you have some troubles with passing 16th test, try 20 3 10 5 5 1 4 8 12 16 I've passed test 16, but stuck on 17... And, by the way, what is right answer on your test? If my solution is correct(it got AC),then it's 0 I'm can't pass test #22 :( This tests very helped me to pass test #16 and test #22: 7 3 5 2 1 1 answer 0 7 4 6 2 1 1 answer 0 Edited by author 09.03.2009 14:55 Could you explain please how to get answer 0 in your tests? like in 1st for example: worm is from 1 to 4 [1;4) it means that empty part are only [0;1) and [4;7) and I couldn't place the barbell without squashing the worm. I'm wrong somewhere, please tell me. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace ConsoleApplication1 { classProgram { staticvoid Main(string[] args) { string Name = "Isenbaev"; ArrayList OF = newArrayList(); ArrayList NF = newArrayList(); int n = int.Parse(Console.ReadLine()); int[,] kol = newint[n, 3]; bool f = false; string[,] name = newstring[n, 3]; for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(' '); for (int j = 0; j < 3; j++) { f = true; kol[i, j] = -1; name[i, j] = s[j]; } } int t=1; OF.Add(Name); while (OF.Count != 0) { for (int z = 0; z < OF.Count; z++) { r = false; for (int i = 0; i < n; i++) { f = false; for (int j = 0; j < 3; j++) { if ((OF[z].ToString().CompareTo(name[i, j]) == 0) && (kol[i, j] == -1)) { kol[i, j] = t - 1; f = true; break; } } if (f) { for (int j = 0; j < 3; j++) { if (OF[0].ToString().CompareTo(name[i, j]) != 0) { int d=0; for (int y = 0; y < OF.Count; y++) { if (name[i, j].CompareTo(OF[y].ToString()) == 0) { d++; } } if (d == 0) { kol[i, j] = t; } NF.Add(name[i, j]); } } } } } OF.Clear(); for (int i = 0; i < NF.Count; i++) { OF.Add(NF[i]); } NF.Clear(); t++; } string[] res = newstring[n*3]; int k=0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { if (kol[i, j] == -1) { res[k] = name[i, j] + " undefined"; } else { res[k] = name[i, j] + " " + kol[i, j]; } k++; } } Array.Sort(res); for (int i = 0; i < (n*3)-1; i++) { if (res[i].CompareTo(res[i + 1]) != 0) { Console.WriteLine(res[i]); } } if ((res[n * 3 - 1]).CompareTo(res[n * 3 - 2]) != 0) { Console.WriteLine(res[n*3-1]); } } } } Your program is not reading 3rd name. use Console.ReadLine().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); istead of Console.ReadLine().Split(' '); m * d1 is count of men needed to complete work in 1 day. You should divide this count into d2 days. On obvious way to do it with min men per day is to add men equally to d2 days one-by-one, while total men count is not 0. Hi. Can you give some samples to help fixing WA on test #3? I think you have problem with diagonal movement because I also have the same problem, but now I have AC Good luck use sqrt(2)/2 Hayk Blrtsyan Great thanks! But I don't undestend why? Sorry, for bad english it has all right answer and why access violation? #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> int a[40][50]; using namespace std; int main(){ int n,i,j,k; cin>>n; a[0][0]=2; a[1][0]=2; if (n>1){ for (i=2; i<n; i++){ for (j=0; j<39; j++){ a[i][j]=a[i-1][j]+a[i-2][j]; } for (j=0; j<19; j++){ a[i][j+1]+=a[i][j]/10; a[i][j]=a[i][j]%10; } } } for (i=39; i>-1; i--){ if (a[n-1][i]>0){ for (j=i; j>-1; j--){ cout<<a[n-1][j]; } break; } } //system("pause"); } I think my code faster But only 4th test Is it? 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 And what will be correct answer this one? Thanks 10000 = 10^4=2^4*5^4 so 10000^10=2^40*5*40 so answer is 41*41 % 10 = 1 and what's test n#2 ??? #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> using namespace std; int main(void) { long double p,q; cin>>p>>q; int n=1,m; int k1,k2; int i,j; if (p<q) { for (m=1; m<100000; m++){ for (i=0; i<=100*m/q; i++){ k1=i; } for (j=0; j<100*m/p; j++){ k2=j; } if (k1+1<=k2){ n=k1+1; break; } } cout<<n; } if (p==q){ } //system("pause"); } #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> long a[100000]; long b[100000]; long c[100000]; int d[100000]; using namespace std; int main(){ int n; int max; cin>>n; int i; for (i=0; i<n; i++){ cin>>a[i]; d[i]=1; } for (i=0; i<n-1; i++){ float r=1+(a[i+1]-a[i])*(a[i+1]-a[i]); c[i]=sqrt(r);
} for (i=0; i<n-2; i++){ if ((a[i]-a[i+1])==(a[i+1]-a[i+2])){ c[i+1]+=c[i]; d[i+1]=d[i]+1; //cout<<d[i]<<" "; } } max=c[0]; int t=0; for (i=0; i<n-1; i++){ if (max<c[i]) { max=c[i]; t=i; } } // cout<<d[0]<<" "<<d[1]<<" "<<d[2]<<" "<<d[3]<<" "; cout<<t+2-d[t]<<" "<<t+2; system("pause"); } thanks I've got AC!!! Edited by author 16.08.2008 02:45 Me too. What's on this test? Is just one white square counted as rectangle? If no, explain me please sample #1. Am I right that output to the sample 1 3 1 1 2 is 0? Please, explain me sample output #1. I can't understand the problem statement. I also can't understand why answer is 8. if 1*1 isn't a white streaks,why the sample#2 is 2 Yes, i have this problem TOO, please answer !!!!!!!!!!!!!! No comments Да правда фигня какая-то. в первом тесте хз почему 8 когда там надо 11. Иначе во 2м должно быть 1 PLZ post in english , I don't under stand the problem too!! Почему во втором тесте 2, а не 4? Или l>1? No you are wrong. 2 is correct [ ] [X] [ ] ^ ^ WHY??? I think because we dont count white stripes two times... Segments 1x1 are counted. But not if they are a part of larger segments. For example: 0 0 X 0 X 0 0 X 0 0 X X 1x1 segment (1,6) is counted. But 1x1 segment (1,2) isn't because it's not maximal. It's part of segment from (1,1) to (1,2). Segment (1,6) is maximal. There is no larger segment containing it. if "NO COMMENTS" why you write this? information - Zero test ID: 4088875 Edited by author 23.01.2012 20:49 Post your source code. #include <iostream> #include <Cmath> void main() { int n, i; long nArray; static int q[65535]; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%l", &nArray); if (floor((sqrtf(1 + 8 * (nArray - 1)) - 1) / 2) == ((sqrtf(1 + 8 * (nArray - 1)) - 1) / 2)) q[i] = 1; else q[i] = 0; } for (i = 0; i < n; i++) { printf("%d ", q[i]); } } Hi, Some observations: - you read a long with %l instead of %ld, which gives then WA3. The %l is not a valid scanf format specifier. On GCC the function doesn't even work (no value read) and on VS2010 the function works but returns junk. - the multiplication 8 * (nArray - 1) overflows the float type as also the long type (nArray can be at most 2^31 - 1). You should convert the multiplication to something bigger, for example the double type. Change also the sqrtf to sqrt. You'll get AC Thank you! I used type Double and %lf to the read. And get AC. P.S. Sorry for my bad English :( |
|