zoukankan      html  css  js  c++  java
  • [解题报告]Zapping

    题目大意

    题目原文:http://uva.onlinejudge.org/external/124/12468.pdf

    背景

    计算电视转台问题,太简单不说了。自己看吧。

                    

                 
    standard input
    standard output
       
    3                             9                                                         

    0                                99                                                            

    12                                27                                                            

    -1                                -1                                                              

    6                                                         

    1                                                            

    15

    算法:

    很简单的算法。自己看看。

    代码:

    这里附上我的代码,你可以去这里提交你的代码验证你的代码是否正确。

     1 #include<stdio.h>
     2 int main(void)
     3 {
     4     int a,b,c,d;
     5     while(scanf("%d %d",&a,&b)!=EOF)
     6     {
     7        if(a==-1&&b==-1)break;
     8 
     9        c=a-b;
    10        d=b-a;
    11 
    12        if(c<0)
    13        c=100+c;
    14        if(d<0)
    15        d=100+d;
    16        if(c>d)
    17        printf("%d\n",d);
    18        else
    19        printf("%d\n",c);
    20     }
    21     return 0;
    22 }
  • 相关阅读:
    linux 内核配置
    使用 git 下载linux 源码
    订阅 linux 邮件列表注意的问题
    使用反射创建一维数组和二维数组
    反射API
    反射机制
    集合案例--对ArrayList容器中的内容进行排序
    Collections
    TreeSet
    Set容器
  • 原文地址:https://www.cnblogs.com/qisong178878915/p/2919276.html
Copyright © 2011-2022 走看看