|
|
вернуться в форумwhat's wrong? WA#9 But, Why? It' is right program! int p = n; for (int i = 0; i < n; i++) { if (f[p]>=k) s[i] = '0'; else { s[i] = '1'; k -= f[p]; } p--; } s[n] = 0; printf("%s\n",s); f[1] = 1, f[2] = 2, f[i] = f[i-1]+f[i-2]; Edited by author 15.03.2007 18:38 Re: what's wrong? you forgot about -1. When k is bigger than all possible sequences then the answer is -1 |
|
|