"SWEA 3456 직사각형 길이 찾기"의 두 판 사이의 차이

(새 문서: ==개요== ;{{PAGENAME}} {{SWEA 헤더}} {{SWEA 난이도 3-4}} |} ==C++== <source lang='cpp'> </source> ==Java== <source lang='java'> import java.util.*; public class Solution {...)
 
15번째 줄: 15번째 줄:
public class Solution {
public class Solution {
public static void main(String[] args) {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
Scanner sc = new Scanner(System.in);
    int T = sc.nextInt();
int T = sc.nextInt();
    for(int tc=1; tc<=T; tc++) {
for(int tc=1; tc<=T; tc++) {
int a = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
int b = sc.nextInt();
25번째 줄: 25번째 줄:
else if( a == c ) result = b;
else if( a == c ) result = b;
System.out.format("#%d %d\n", tc, result);
System.out.format("#%d %d\n", tc, result);
    }
}
        sc.close();
sc.close();
    }
}
}
}
</source>
</source>

2018년 12월 25일 (화) 15:24 판

1 개요

SWEA 3456 직사각형 길이 찾기
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 3-4

2 C++

3 Java

import java.util.*;
public class Solution {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int tc=1; tc<=T; tc++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int result = a;
			if( a == b ) result = c;
			else if( a == c ) result = b;
			System.out.format("#%d %d\n", tc, result);
		}
		sc.close();
	}
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}