码迷,mamicode.com
首页 > 编程语言 > 详细

各种编程语言的输入

时间:2018-09-01 15:53:12      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:turn   i++   integer   ret   stat   static   strip   string   pytho   

python

def solution(line):
a, b = line.strip().split()
return str(int(a) + int(b))

Java

private static String solution(String line) {
// 在此处理单行数据
String[] array = line.split(" ");
int count = 0;
for (int i = 0; i < array.length; i++) {
int a = Integer.parseInt(array[i]);
count = count + a;
}
String result = Integer.toString(count);
// 返回处理后的结果
return result;
}

各种编程语言的输入

标签:turn   i++   integer   ret   stat   static   strip   string   pytho   

原文地址:http://blog.51cto.com/13927451/2168539

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!