- 코딩 공부/Algorithm

파티가 끝나고 난 뒤

방개입니다 2021. 3. 16. 21:15

www.acmicpc.net/problem/2845

 

2845번: 파티가 끝나고 난 뒤

파티가 끝나고 나면, 사람들은 누가 파티에 왔는지와 얼마나 많은 사람들이 왔는지를 궁금해한다. 보통 파티는 매우 크게 열리기 때문에, 정확하게 몇 명이 참가했는지 알 수가 없다. 지난주 토

www.acmicpc.net

 

import java.util.Scanner;

public class afterparty {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int total = a * b;

        int c = sc.nextInt();
        int d = sc.nextInt();
        int f = sc.nextInt();
        int g = sc.nextInt();
        int h = sc.nextInt();

        System.out.printf("%d %d %d %d %d", c-total, d-total,f-total,g-total,h-total);

    }
}