|
|
вернуться в форумVERY easy :) A - first divider of K, which is more or equal than 3 (A>=3) We need write A-1. AC - 0.578 and 134 KB Edited by author 27.03.2010 14:34 Re: VERY easy :) Послано pkl 18 авг 2011 03:04 I made the same, but WA on test 11. What's the matter? I see a solution in another topic, there used I64. Oh, don't tell me to use I64. 10^8 is involved to int. Why does not it work? <code> #include <stdio.h> int K; int L; int main() { scanf("%d", &K); L = 2; while (K%(L+1) != 0) { if ((L+1)*(L+1) > K) { printf("%d\n", K-1); return 0; } L++; } printf("%d\n", L); return 0; } </code> Edited by author 18.08.2011 03:22 Re: VERY easy :) Послано pkl 18 авг 2011 03:55 At last. I undestood. Expression "if ((L+1)*(L+1) > K)" not correct, because we skip 2. Since for K=8, we return 7, when the correct answer is 3. Edited by author 18.08.2011 03:56 Re: VERY easy :) > I made the same No I see u didn't :) The actual solution is 5 lines, 4 of which are declarations and i/o Edited by author 27.11.2011 17:43 |
|
|