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 11119999 at 2006-08-26 14:30:10 on Problem 1338
#include<stdio.h>

int r[1501];
int Min(int a,int b,int c){
    if(a<b)b=a;
    if(b<c)c=b;
    return c;
}    
int main(){
    int a;
    int b;
    int c;
    int i;
    int j;
    
    r[1]=1;r[2]=2;r[3]=3;r[4]=4;r[5]=5;
    a=3; b=2;  c=2;  
    for(i=6;i<=1500;i++){
        r[i]=Min(r[a]*2,r[b]*3,r[c]*5);
        for(;r[a]*2<=r[i];a++);
        for(;r[b]*3<=r[i];b++);
        for(;r[c]*5<=r[i];c++);
    }
    scanf("%d",&i);
    while(i){
        printf("%d\n",r[i]);
        scanf("%d",&i);
    }
    return 0;
}        
        
        

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