141b-hopscotch
Let's bust the "level" 0≤ i ≤106, with which assumedly the stone could hit. Let's find the minimal number of square on the. Then we can understand, how many squares there is on this level:one or both. Then we check with one or both ifs (if on this level, squares) if the stone is in corresponding square or not. If the stone is inside then output the answer. If we didn ' t find any square, where the stone is, output "-1".
The official meaning is probably 6 levels, one to enumerate past (well, Bo Master English is not good, nonsense);
At first only to see the diagram, think up to 7 (As for 1-1-2-1 ..., don't know what), has been WA
Until....
After reading the topic, decisive add these words
0 ; while 5 * a) 32 * A; printf ("%d\n", Calculate (A, x, y) + tmp * (Calculate (A, x, y)! =-1));
Number of floors > 7, Ordinate -2*a, ordinal-3 (the premise is naturally in the lattice), then .....
Actually, it's a.
#include <bits/stdc++.h>intf[ -];intCalculateintAintXinty);intMain () {intA, x, Y, tmp; f[1] =1; for(inti =2; I <8; i++) F[i] = f[i-1] +1; while(~SCANF ("%d%d%d", &a, &x, &y)) {tmp=0; while(Y >5* a) TMP + =3, Y-=2*A; printf ("%d\n", calculate (A, x, y) + tmp * (Calculate (A, x, y)! =-1)); } return 0;}intCalculateintAintXinty) {if(x < (A +1) /2&& x >-(A +1) /2&& y >0&& y < a)returnf[1]; if(x < (A +1) /2&& x >-(A +1) /2&& y > a && y <2Areturnf[2]; if(X <0&& x >-a && y >2* A && y <3Areturnf[3]; if(X >0&& x < a && y >2* A && y <3Areturnf[4]; if(x < (A +1) /2&& x >-(A +1) /2&& y >3* A && y <4Areturnf[5]; if(X <0&& x >-a && y >4* A && y <5Areturnf[6]; if(X >0&& x < a && y >4* A && y <5Areturnf[7]; Else return-1;}
#CF 141B. Hopscotch