Java—得分
Description
最近,科比总得分超过乔丹,科比球打的很棒…
那么问题来了,科比有一场比赛投中a个3分球,b个2分球,罚进了c个球(罚球得一分),这场比赛总共得了多少分?
Input
多组输入。
每行包含3个数字a,b,c( 0<=a,b,c <= 100)
Output
输出所求的结果。
Sample
Input
7 21 18
Output
81
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner reader = new Scanner(System.in);
int a, b, c, sum;
while (reader.hasNext()) {
a = reader.nextInt();
b = reader.nextInt();
c = reader.nextInt();
sum = 0;
sum = 3 * a + 2 * b + c;
System.out.println(sum);
}
}
}