/* * @(#) ir94_2.c - Problem 2 ("Parket stacking") solution * of the All-Russia Olympiad in Informatics in 1994. * (c) 1994 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: ANSI C * Tested with: Watcom C 16/32 v10.0 * Last modified: 1994-08-25 11:45:00 GMT+04:00 */ #include int m,n; long double a[256],b[256]; int test(int i, int j, int nn) { if (i&j) return 0; for (;nn;nn>>=1,i>>=1,j>>=1) { if ((i^j)&1) continue; if (nn==1 || (i&1)!=((i>>1)&1) || (j&1)!=((j>>1)&1)) return 0; nn>>=1,i>>=1,j>>=1; } return 1; } int main(void) { int i,j,k; scanf("%*[^0-9]%d%*[^0-9]%d",&m,&n); n=1<