zoukankan      html  css  js  c++  java
  • HDU 1393 Weird Clock (英语,纪念题)

    这题简单,只要看懂题目就好,坑爹的是我的英语水平太差了,wa了n次,所以 仅此纪念 一下。

    //坑爹的英语题目,注意重点:move d times clockwise the current time 
    #include<stdio.h>
    #include<string.h>
    int main()
    {
        int s,d,i,e,f[66];
        while(scanf("%d%d",&s,&d)!=EOF)
        {
            if(s==0&&d==0)break;
            e=s;
            for(i=0;i<60;i++)//标记一下,以免超时
                f[i]=0;
            f[e]=1;
            for(i=0;;i++)
            {
                e=(e*d+e)%60;
                if(f[e]==1)
                {
                    printf("Impossible
    ");
                    break;
                }
                if(f[e]==0)
                    f[e]=1;
                if(e==0)
                {
                    printf("%d
    ",i+1);
                    break;
                }
                if(e==s)
                {
                    printf("Impossible
    ");
                    break;
                }
            }
        }
        return 0;
    }
    View Code
    一道又一道,好高兴!
  • 相关阅读:
    投票练习
    多条件查询
    PHP 购物车
    PHP TP模型
    PHP smarty函数
    PHP smarty复习
    PHP smarty缓存
    PHP phpcms
    php smarty查询分页
    PHP Smarty变量调节器
  • 原文地址:https://www.cnblogs.com/laiba2004/p/3234614.html
Copyright © 2011-2022 走看看