aoj.339.Large or small
来源:互联网 发布:射手影音 mac 编辑:程序博客网 时间:2024/06/05 20:33
Large or small
Description
Only Input and Output
Input
Several cases.
A letter indicating the operation('L' means to output the lager one while 'S' the smaller).
Followed by two integers. It's guaranteed that all numbers are smaller than 10^5.
A letter indicating the operation('L' means to output the lager one while 'S' the smaller).
Followed by two integers. It's guaranteed that all numbers are smaller than 10^5.
Output
According to the operation to output the lager or smaller integer on a seperate line.
If the letter is not 'L' or 'S' just print "Input error!".
If the letter is not 'L' or 'S' just print "Input error!".
Sample Input
L 3 4S 3 4
Sample Output
43
法一:清理缓存法
#include"stdio.h"int main(){char ch;long x,y;while(scanf("%c",&ch)!=EOF){scanf("%ld %ld",&x,&y);if(ch=='L')printf("%ld\n",x>y?x:y);else if(ch=='S')printf("%ld\n",y>x?x:y);elseprintf("Input error!\n")fflush(stdin); /*清理缓存,清除上次执行命令的换行*//*aoj无法通过??*/}return 0;}法二:当输入换行时执行下次循环,去除关于换行的代入执行#include"stdio.h"
int
main()
{
char
ch;
long
x,y;
while
(
scanf
(
"%c"
,&ch)!=EOF)
{
if
(ch==
'\n'
)
/*判断读入的是否为换行符*//*换行符来自上次最后键入的命令*/
continue
; /*是则结束本次循环*/
scanf
(
"%ld %ld"
,&x,&y);
if
(ch==
'S'
)
printf
(
"%ld\n"
,x<y?x:y);
else
if
(ch==
'L'
)
printf
(
"%ld\n"
,x>y?x:y);
else
printf
(
"Input error!\n"
);
}
return
0;
}
0 0
- aoj.339.Large or small
- 1212 -- Large or small
- 托福写作2-large or small company employee
- small compact large区别
- Windows的Large Page和Small Page
- 51单片机small compact large区别
- 单片机small、compact、large存储模式
- UVa 819- Gifts Large and Small
- IRibbonCategoryEditor 找不到&&无法设置Large(Small) Images
- ptmalloc代码浅析2(small bin/large bin结构图)
- 51单片机的small compact large编译模式
- NAND flash small block 与 large block 的区别
- 2015 Investment Playbook Small Caps Versus Large Caps ,Chicago Blackhawks
- Small Codes and Large Image Databases for Recognition
- [搜索or枚举]AOJ 0525 Osenbei
- AOJ
- Aoj
- my-large&my-medium&my-small&my-innodb-heavy-4G
- [历年IT笔试题]暴风影音笔试题集锦
- C/C++学习:某日期到今天总天数
- 加速计(重力感应功能)的使用
- 【蓝桥杯训练】--- 算法训练 Torry的困惑(基本型)
- Cocos2d-x 3.2下精灵Sprite的创建
- aoj.339.Large or small
- Java中的抽象类和接口
- file标签之轻松删除文件和目录
- eclipse 找不到Courier New 字体
- [Leetcode 172, Easy] Factorial Trailing Zeroes
- bzoj 2453: 维护队列
- WPF动态修改皮肤
- [历年IT笔试题]美团2015校园招聘笔试题
- 寒假学术休假项目7-大奖赛计分系统(文件读写版)