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 |
进来看下,比较简练的写法#include <stdio.h> int gcd(int n, int m){ n=(n>0)?n:-n; m=(m>0)?m:-m; if(!n)return m; if(!m)return n; if(n>m)return gcd(m,n%m); return gcd(n,m%n); } int main() { int n,m; while(scanf("%d%d",&n,&m)>0){ printf("%10d%10d %sd Choice\n\n", n,m,(gcd(n,m)^1)?"Ba":"Goo"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator