#3163. Large Digits

0
    ID: 3163 传统题 2000ms 1024MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>AtCoderabc187AGESP 1级数位拆分分支结构

Large Digits

Large Digits

题目描述

For an integer nn, let S(n)S(n) be the sum of digits in the decimal notation of nn. For example, we have S(123)=1+2+3=6S(123) = 1 + 2 + 3 = 6. Given two 33-digit integers AA and BB, find the greater of S(A)S(A) and S(B)S(B).

输入格式

Input is given from Standard Input in the following format: AA BB

输出格式

Print the value of the greater of S(A)S(A) and S(B)S(B).
If these are equal, print S(A)S(A).

123 234
9
593 953
17
100 999
27

提示

All values in input are integers. 100≤A,B≤999100 \le A, B \le 999We have S(123)=1+2+3=6S(123) = 1 + 2 + 3 = 6 and S(234)=2+3+4=9S(234) = 2 + 3 + 4 = 9, so we should print the greater of these: 99.

标签: AtCoder|abc187A

来源

AtCoder|abc187A