A1312 | [COCI-2015_2016-contest4]#6 YODA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
A long, long time ago in a galaxy far, far away a big collision of integers is taking place right now.
What happens when two integers collide? During collision, each digit of one number compares itself to the corresponding digit of the other number (the least significant digit with the other’s least significant digit, and so on). The smaller digit “falls out” of the number containing it. Additionally, if the digits are the same, nothing happens. If a number doesn’t consist of a corresponding digit, then we consider it to be zero. After all comparisons of corresponding digits, the leftover digits in the number come closer and create a new number. For example:
Write a programme that will, for two given integers, determine their values after collision. If it happens that all the digits of one number fell out, then for that number output the message “YODA”.
What happens when two integers collide? During collision, each digit of one number compares itself to the corresponding digit of the other number (the least significant digit with the other’s least significant digit, and so on). The smaller digit “falls out” of the number containing it. Additionally, if the digits are the same, nothing happens. If a number doesn’t consist of a corresponding digit, then we consider it to be zero. After all comparisons of corresponding digits, the leftover digits in the number come closer and create a new number. For example:
Write a programme that will, for two given integers, determine their values after collision. If it happens that all the digits of one number fell out, then for that number output the message “YODA”.
输入格式
The first line of input contains the integer N (1 6 N 6 109 ), one of the integers from the task.
The second line of input contains the integer M (1 6 N 6 109 ), one of the integers from the task.
The second line of input contains the integer M (1 6 N 6 109 ), one of the integers from the task.
输出格式
The first line of output must contain the new value of the first given integer from the task.
The second line of output must contain the new value of the second given integer from the task.
The second line of output must contain the new value of the second given integer from the task.
输入输出样例
输入 #1
300 500
输出 #1
0 500
输入 #2
65743 9651
输出 #2
673 95
输入 #3
2341 6785
输出 #3
YODA 6785
In test cases worth 30% points it will hold that N and M consist of three digits
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted