列表

详情


NC25071. [USACO 2007 Ope l]New Cow IDs

描述

Bessie's bovine thought processes occasionally take her into mathematical realms unfathomed by her barn-mates.
She watched the cows walk by with their serial numbers (1 <= serial_number <= 999,999) on display. She thought perhaps the numbers might have more interesting properties if one calculated the sum of the number and the reverse of that number. Help her perform this calculation.
Here are some examples:
.
23 + 32 = 55
123 + 321 = 444
9730 + 379 = 10109

输入描述

Line 1: A single integer that is the serial number to be transformed

输出描述

Line 1: A single integer that is the transformed serial number

示例1

输入:

9730

输出:

10109

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

pypy3 解法, 执行用时: 85ms, 内存消耗: 49444K, 提交时间: 2023-04-11 14:14:40

a=input()
s=int(a)+int(a[::-1])
print(s)

Python3 解法, 执行用时: 44ms, 内存消耗: 4536K, 提交时间: 2023-04-13 18:27:40

n=input()
print(int(n)+int(n[::-1]))

上一题