UVA 10055

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=996&mosmsg=Submission+received+with+ID+11307262

计算士兵数差值,即大减小,可以用绝对值,也可以先判断大小,再做运算

View Code
 1 #include<stdio.h>  
 2 int main()
 3 {
 4  int a,b,t;
 5  while(scanf("%d%d",&a,&b)!=EOF)
 6      {
 7       if(a>b)
 8     {
 9      t=a;
10      a=b;
11      b=t;
12     }
13       printf("%d\n",b-a);
14      }
15  return 0;
16 }

 

posted @ 2013-02-19 09:57  执着追求的IT小小鸟  阅读(86)  评论(0编辑  收藏  举报