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

 
(사용자 3명의 중간 판 11개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;SWEA 2070 큰 놈, 작은 놈, 같은 놈
{{SWEA|난이도=1}}
*
* a가 크면 '>'를 출력하고, b가 크면 '<'를 출력한다.
 
{{SWEA 헤더}}
{{SWEA 난이도 1-1}}
|}


==C++==
==C++==
<source lang='cpp'>
<syntaxhighlight lang='cpp'>
</source>
#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;
    }
}
</syntaxhighlight>


==Java==
==Java==
<source lang='java'>
<syntaxhighlight lang='java'>
</source>
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);
        }
    }
}
</syntaxhighlight>
 
==Python==
<syntaxhighlight lang='python'>
#kcy
k = int(input())
for i in range(0, k):
    a, b = map(int, input().split())
    print("#%d" % (i+1), end=' ')
    if a < b:
        print("<")
    elif a == b:
        print("=")
    else:
        print(">")
</syntaxhighlight>
<syntaxhighlight lang='python'>
T = int(input())
for tt in range(0, T):
    a, b = map(int, input().split())
    print( f"#{tt+1} ", end='' )
    if a < b:
        print("<")
    elif a == b:
        print("=")
    else:
        print(">")
</syntaxhighlight>

2023년 8월 25일 (금) 01:40 기준 최신판

1 개요[ | ]

SWEA 2070 큰 놈, 작은 놈, 같은 놈

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);
        }
    }
}

4 Python[ | ]

#kcy
k = int(input())
for i in range(0, k):
    a, b = map(int, input().split())
    print("#%d" % (i+1), end=' ')
    if a < b:
        print("<")
    elif a == b:
        print("=")
    else:
        print(">")
T = int(input())
for tt in range(0, T):
    a, b = map(int, input().split())
    print( f"#{tt+1} ", end='' )
    if a < b:
        print("<")
    elif a == b:
        print("=")
    else:
        print(">")
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}