【題解】ZeroJudge d143: 11172 – Relational Operators

【題目敘述】https://zerojudge.tw/ShowProblem?problemid=d143

#include <iostream>
using namespace std;

int main() {
    int T, a, b;
    cin >> T;
    while (T--){
        cin >> a >> b;
        if (a < b) cout << "<\n";
        else if (a > b) cout <<  ">\n";
        else cout << "=\n";
    }
}

Python code (credit: Amy Chou)

T = int(input())
while T:
    T -= 1
    a, b = map(int, input().split())
    if a < b:
        print("<")
    elif a > b:
        print(">")
    else:
        print("=")
分享本文 Share with friends