SWexpertAcademy(2072)

2072 홀수만 더하기 (D1)

import java.util.Scanner;
public class Solution {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int num = stdIn.nextInt();
		int number = 1;
		for(int i = 0; i < num; i++) {
			int total = 0;
			for (int j = 0; j< 10; j++) {
				int N = stdIn.nextInt();
				if(N % 2 == 1) {
					total += N;
				}
			}
			System.out.println("#" + number + " "+ total);
			number+= 1;
		}
	}

}

※ 클래스 명을 Solution으로 해야한다


참고자료

0%