uva 1055

来源:互联网 发布:网络销售彩票聊天技巧 编辑:程序博客网 时间:2024/05/29 03:50

今天买的刘汝佳的算法竞赛入门经典 ,然后就去UVa上去做了专门为这本书准备的题库,第一道题,简单的减法,求差异,前面几次WA以为是后面的减去前面的,后来才看题知道只是求差异 ,而后想用 abs 函数,貌似是会溢出

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

# include<stdio.h>

int main()
{
    unsigned 
long long a = 0,b = 0;
    
while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        
if(a>b) printf("%lld/n",a-b);
        
else printf("%lld/n",b-a);
    }
    
return 0;
}


提交后 是0.064s 我看有有0.00s 不知道大家有什么性能改进的意见 不吝赐教

原创粉丝点击