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 |
WA的有点郁闷。。。大家能帮我看看吗?/* Author: sgxiao Title: 2499 -- Binary Tree LANG: C Date : Sun Aug 31 17:12:54 CST 2008 */ #include<stdio.h> #define TYPE unsigned long long int /* #define TYPE int */ TYPE l, r; void node(TYPE i, TYPE j) { if( i == j ) return; if( i == 0 || j == 0) return ; if( i == 1 || j == 1 ) { l += i - 1; r += j - 1; return; } if( i > j ) { l += (TYPE)(i/j); node(i%j, j); } else { r += (TYPE)(j/i); node(i, j%i); } } int main(void) { TYPE i, j; int k; int n; scanf("%d", &n); for(k = 1; k <= n; k++) { scanf("%llu%llu", &i, &j); node(i, j); printf("Scenario #%d:\n", k); printf("%llu %llu\n\n", l, r); l = 0; r = 0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator