"SWEA 2070 큰 놈, 작은 놈, 같은 놈"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
==개요==
==개요==
;SWEA 2070 큰 놈, 작은 놈, 같은 놈
;SWEA 2070 큰 놈, 작은 놈, 같은 놈
* https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QQ6qqA40DFAUq
* a가 크면 '>'를 출력하고, b가 크면 '<'를 출력한다.


{{SWEA 헤더}}
{{SWEA 헤더}}

2019년 1월 21일 (월) 00:06 판

1 개요

SWEA 2070 큰 놈, 작은 놈, 같은 놈
  • a가 크면 '>'를 출력하고, b가 크면 '<'를 출력한다.
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 1-1

2 C++

#include <iostream>
using namespace std;
int main() {
    int T, a, b;
    cin >> T;
    for(int tc=1; tc<=T; tc++) {
        cin >> a >> b;
        char res = '=';
        if( a>b ) res ='>';
        else if( a<b ) res = '<';
        cout << "#" << tc << " " << res << endl;
    }
}

3 Java

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