UVA 10055 Hashmat the brave warrior
来源:互联网 发布:淘宝举报漏洞有奖励吗 编辑:程序博客网 时间:2024/06/09 23:38
UVA 10055 Hashmat the brave warrior
大意:输入两个数,输出两个数差多少。
纯水题。
第一个思路:用绝对值
long long a,b;while (scanf("%lld %lld", &a, &b) != EOF){ printf ("%lld\n",(long long)fabs(a-b));}
第二个思路:用条件表达式(三目元算符)
long long a,b; while (scanf("%lld %lld", &a, &b) != EOF){ printf("%lld\n", a > b ? (a - b) : (b - a)); }
C语言提交版本:
#include <stdio.h>int main(){ long long a,b; while (scanf("%lld %lld", &a, &b) != EOF){ printf("%lld\n", a > b ? (a - b) : (b - a)); } return 0;}
C++提交版本:
#include <iostream>using namespace std;int main(){ long long a,b; while (cin>>a>>b){ cout<<(a>b ? a-b : b-a)<<endl; } return 0;}
0 0
- UVa OJ 10055-Hashmat the Brave Warrior
- UVa:10055 - Hashmat the Brave Warrior
- UVa 10055 Hashmat the brave warrior
- uva 10055 Hashmat the Brave Warrior
- UVA 10055 - Hashmat the Brave Warrior
- uva-10055 - Hashmat the Brave Warrior
- uva 10055 Hashmat the Brave Warrior
- UVa OJ 10055 - Hashmat the Brave Warrior
- UVa 10055 - Hashmat the Brave Warrior
- UVA 10055 Hashmat the brave warrior
- uva 10055 Hashmat the brave warrior
- UVa 10055 Hashmat the brave warrior
- UVA 10055 Hashmat the brave warrior
- UVA - 10055 - Hashmat the Brave Warrior
- uva 10055 - Hashmat the Brave Warrior
- UVA OJ: 10055 - Hashmat the Brave Warrior
- UVa 10055 - Hashmat the Brave Warrior
- UVA 10055 Hashmat the Brave Warrior
- LeetCode --- 4. Median of Two Sorted Arrays
- Core Data框架是什么?
- virtualbox下安装ubuntu
- LeetCode --- 5. Longest Palindromic Substring
- 私人日志
- UVA 10055 Hashmat the brave warrior
- ICC 卡知识点
- 《stl源码剖析》-- 空间配置器
- 时序的问题
- c++_primer_exercise_1438_1439
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 葡萄插件 整理2 数据导出
- 一些基本数据类型问题
- Python split() 函数 拆分字符串 将字符串转化为列