|
|
Общий форумtype vector=array[0..750000] of longint; var n:longint; s,t:ansistring; x:longint; function qqq(s,t:ansistring):longint; var f:vector; k,i:longint; result:longint; begin result:=-1; f[1]:=0; k:=0; for i:=2 to length(s) do begin while (k>0) and (s[k+1]<>s[i]) do k:=f[k]; if s[k+1]=s[i] then inc(k); f[i]:=k; end; k:=0; for i:=1 to length(t) do begin while (k>0) and (s[k+1]<>t[i]) do k:=f[k]; if s[k+1]=t[i] then inc(k); if k=length(s) then begin result:=i+length(t); break; end; end; qqq:=result; end; begin readln(n); readln(s); readln(t); x:=qqq(s,t+t); writeln(x mod length(s)); readln; end. what is it on test number 4. Hello Everyone, I would like to invite you all to "CodeCraft 08", a programming contest conducted by IIIT, Hyderabad as part of their technical fest "Threads". The contest is scheduled on 27th January. The contest is open to everyone. For more details and to register for the event, please visit http://felicity.iiit.ac.in/codecraft/. The problemset is more challenging and interesting as compared to CodeCraft 07. I hope you all will participate and enjoy the contest. Edited by author 14.01.2008 18:40Why cant we just output first M prime numbers??? WA1 #include<stdio.h> #include<math.h> void main() {int n,h; bool f; scanf("%i%i",&n,&n); printf("YES\n1"); for(int i=2,j=1;j<n;i++) {h=(int)sqrt((float)i); f=0; for(int k=2;k<=h;k++) if((i%k)==0) {f=1;break;} if(!f){printf(" %i",i);j++;} } } Because numbers must be [1..M] Can someone give me test case..i use insertion sort to calculate number of jumps. You could not send me the test № 3 on my e-mail (tyana_gr@mail.ru), please Edited by author 13.01.2008 20:56 what's test #35? I have found my mistakes. And I'd like to supply some test. TS * 3S YES *KS TS * QCD YES *6D Is it a digraph or an undigraph? UNDIGRAPH note that: exist 2 way between 2 vertix/ Why i get WA on test 5? This is my solution: var r,sum,n:extended; begin readln(input,r); sum:=4*sqr(r); n:=int((sqrt(2)-1)*r/sqrt(2)); write(output,(sum-2*n*(n+1)):0:0); end. Edited by author 24.05.2007 21:21 [sorry man] Edited by author 04.11.2007 00:27 Edited by author 04.11.2007 00:27 Buy Iphone! You are TEAPOT!!!!!!!!!!!!!!!!!!!!!! Try this test, when I had WA #14 it helped me. input: 3 1:00:00 7:00:00 7:00:00 output: 7:00:00 I think, that my program is right... but WA :( Pls help 5 1 0 0 0 0 -10 0 10 0 100 Answer: 5 1 5 4 2 3 One more test: 14 4 4 3 2 2 2 0 0 1 0 1 2 2 4 5 6 3 6 7 7 7 5 6 2 3 0 5 0 One of possible answers: 14 1 10 11 2 12 14 13 5 4 3 8 6 7 9 is sequence of two slash symbols is a command? For example: \\"" \endinput What is right output? \\" or not? The right output is \\" \endinput My AC program output: //``'' /endinput I work using C++. But on this problem I saw that for my algorithm it is not enough double and long double. And only pascal's extended gave me this AC. That's because double has about 340 in exponent, and long double not in all compilers have 12 bytes, sometimes long double=double I have no idea why I have CE on this solution. Can anyone help me? #include <iostream> #include <stdio.h> #include <math.h> #include <algorithm> using namespace std; long double eps = 1e-4; int main () { double r, l, sq; cin>>l>>r; if (2*r <= l) { sq = M_PI*r*r; } else if (l*l <= 2*r*r) { sq = l*l; } else { double cs = (l/2)/r, angle; angle = acos (cs); sq = r*l/2*sin (angle); angle *= 8, sq *= 4; double sq2 = (2*M_PI-angle)*r*r/2; if (sq2 < eps) { sq -= sq2; } else { sq += sq2; } } printf ("%.3lf", sq); return 0; } It was my problem too. just use 3.1415... instead of M_PI. M_PI is not declared for the INTEL compiler. Use this and you got AC! Answer(n,m)=abs( Answer(1,n)-Answer(1,m) ) check this(130 tests) and YOU got AC (I think) (N M Answer) 1 1 0 1 2 0 1 3 0 1 4 1 1 5 2 1 6 2 1 7 2 1 8 4 1 9 6 1 10 6 1 11 6 1 12 7 1 13 8 1 14 8 1 15 8 1 16 11 1 17 14 1 18 14 1 19 14 1 20 15 1 21 16 1 22 16 1 23 16 1 24 18 1 25 20 1 26 20 1 27 20 1 28 21 1 29 22 1 30 22 1 31 22 1 32 26 1 33 30 1 34 30 1 35 30 1 36 31 1 37 32 1 38 32 1 39 32 1 40 34 1 41 36 1 42 36 1 43 36 1 44 37 1 45 38 1 46 38 1 47 38 1 48 41 1 49 44 1 50 44 1 51 44 1 52 45 1 53 46 1 54 46 1 55 46 1 56 48 1 57 50 1 58 50 1 59 50 1 60 51 1 61 52 1 62 52 1 63 52 1 64 57 1 65 62 1 66 62 1 67 62 1 68 63 1 69 64 1 70 64 1 71 64 1 72 66 1 73 68 1 74 68 1 75 68 1 76 69 1 77 70 1 78 70 1 79 70 1 80 73 1 81 76 1 82 76 1 83 76 1 84 77 1 85 78 1 86 78 1 87 78 1 88 80 1 89 82 1 90 82 1 91 82 1 92 83 1 93 84 1 94 84 1 95 84 1 96 88 1 97 92 1 98 92 1 99 92 1 100 93 1 101 94 1 102 94 1 103 94 1 104 96 1 105 98 1 106 98 1 107 98 1 108 99 1 109 100 1 110 100 1 111 100 1 112 103 1 113 106 1 114 106 1 115 106 1 116 107 1 117 108 1 118 108 1 119 108 1 120 110 1 121 112 1 122 112 1 123 112 1 124 113 1 125 114 1 126 114 1 127 114 1 128 120 1 129 126 1 130 126 Use this and you got AC! I think big test is also useful: 1 2147483647 2147483586 Also usefull tests: WA 8: 4 12 (answer = 6) WA 18: 7 9 (answer = 4) |
|
|