Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求最大公约数, 若是为一 , 就是好的;否则 就是坏的, 至于 求最大公约数, 实在不行, 枚举也可;

Posted by 117474335 at 2010-09-28 17:18:27 on Problem 1597 and last updated at 2010-09-28 17:21:06
枚举和求最大公约数都是0ms  ;

#include <stdio.h>
main () 
{
    int a, b , i, t ;
    while (scanf ("%d%d", &a, &b) != -1){
        printf ("%10d%10d", a, b) ;
        t = a <b ? a : b ;
        for (i = 2; i <= t; i ++ ) if (a % i == 0 && b % i == 0) break ;  
        if (i > t) printf ("    Good Choice\n\n") ;
        else printf ("    Bad Choice\n\n") ;}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator