Dev.baelanche

[백준 10569] 다면체 본문

Data Structure & Algorithm/PS - JAVA

[백준 10569] 다면체

baelanche 2019. 4. 19. 21:36
반응형

 

우리가 구해야 하는 것은 면의 수 이고 주어진 식을 활용하면 된다.

면의 수가 x 일때

 

v - e + x = 2

x = e - v + 2 이다.

 

 

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int t = sc.nextInt();
        while(t-->0) {
            int v = sc.nextInt();
            int e = sc.nextInt();
            System.out.println(2 - v + e);
        }
    }
}
반응형

'Data Structure & Algorithm > PS - JAVA' 카테고리의 다른 글

[백준 2965] 캥거루 세마리  (0) 2019.04.19
[백준 2921] 도미노  (0) 2019.04.19
[백준 2914] 저작권  (0) 2019.04.19
[백준 1449] 수리공 항승  (0) 2019.04.19
[백준 4796] 캠핑  (0) 2019.04.19
Comments