본문 바로가기
Beakjoon&프로그래머스/Java

[백준/Java] 10797번 10부제

by 현장 2022. 4. 18.

-Code

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int day = sc.nextInt();
        int cnt = 0;

        for (int i = 0; i < 5; i++) {
            int car = sc.nextInt();
            if (car % 10 == day) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}