uva 10055
雖然是水題,但是如果使用abs來取絕對值進行運算的話,直接超時。
#include <stdio.h>
int main(){
long int a,b,c;
while(scanf("%ld%ld",&a,&b)==2){
c=a-b;
if(c<0)
c=-c;
printf("%ld\n",c);
}
return 0;
}
雖然是水題,但是如果使用abs來取絕對值進行運算的話,直接超時。
#include <stdio.h>
int main(){
long int a,b,c;
while(scanf("%ld%ld",&a,&b)==2){
c=a-b;
if(c<0)
c=-c;
printf("%ld\n",c);
}
return 0;
}
II U C ONLINE C ON TEST 2 008 Problem D: GCD LCM Input: standard input Output: standard output The
問題: 一個渡口,有一艘渡船,運汽車到對面,一次能運n輛車,到達對面要t分鐘,返回要t分鐘,一共來m輛車。 給出m個數據,是到達渡口的時間。求最短把