Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
瞎扯In Reply To:n =1 是输出1,wa了几次 Posted by:969869102 at 2010-08-29 21:09:20 #include <stdio.h> __int64 a, b, c; int n ; main () { int i ; while (scanf ("%d" , &n) , n != -1){ if (n % 2){printf ("0\n") ; continue ;} if (!n){printf ("1\n") ; continue ;} n /= 2 ; a = 3; b = 11 ; for (i = 3; i <= n; i ++ ){ c = 4 * b - a ; a = b ; b = c ;} if (n == 1) printf ("3\n") ; else printf ("%I64d\n" , b) ;} } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator