PersonalCorpus 版 (精华区)

1044481 Big Guava ... 467 Accepted 0:00.490
392 2002/08/27 07:25:59.108

void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\uva\\input467.txt","r",stdin);
    freopen("c:\\0acm\\uva\\output467.txt","w",stdout);
#endif

    char s[100];
    int i,j,k=0,a[10],b[10],n;

    while (gets(s)!=NULL) {
        printf("Set %d ",++k);
        i=0; n=0; j=10000;
        while (s[i]!=0) {
            sscanf(s+i,"%d",a+n); b[n]=a[n]-5; a[n]+=a[n];
            if (b[n]<j) j=b[n];
            n++;
            while (isdigit(s[i])) i++;
            while ((s[i]!=0)&&(!isdigit(s[i]))) i++;
        }
        for (i=j;i<=3600;i++) {
            for (j=0;j<n;j++) if (i%a[j]>=b[j]) break;
            if (j==n) break;
        }
        if (i<=3600)
            printf("synchs again at %d minute(s) and %d second(s) 
after all turning green.\n",i/60,i%60);
        else printf("is unable to synch after one hour.\n");
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.031毫秒