結果
問題 |
No.3032 ホモトピー入門
|
ユーザー |
![]() |
提出日時 | 2025-05-14 13:08:08 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,884 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 67,316 KB |
最終ジャッジ日時 | 2025-05-14 13:09:32 |
合計ジャッジ時間 | 4,330 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 37 |
ソースコード
import sys # Set input function to use sys.stdin.readline for potentially faster I/O # compared to the built-in input() function, especially for a large number of lines. input = sys.stdin.readline def solve(): # Read the number of pairs, N N = int(input()) # Define characters for output using their ASCII values. # This is necessary because the problem statement forbids the use of # '<' and '>' characters directly in the source code. # ASCII 61 corresponds to '=' # ASCII 60 corresponds to '<' # ASCII 62 corresponds to '>' char_eq = chr(61) char_lt = chr(60) char_gt = chr(62) # Create a list to store the comparison result string for each pair. # Storing results and printing them all at once can sometimes be more efficient # than printing inside the loop, though for N <= 100 the difference is likely negligible. results = [] # Loop N times to process each pair of integers (a_i, b_i) for _ in range(N): # Read the two integers a and b for the current pair from a single line of input. # map(int, input().split()) reads the line, splits it by spaces, # and converts each part to an integer. a, b = map(int, input().split()) # --- Comparison Logic --- # The core task is to compare a and b without using '<' or '>' operators. # Case 1: Check if a is equal to b. The equality operator '==' is allowed. if a == b: # If a and b are equal, append the '=' character to the results list. results.append(char_eq) # Case 2: If a is not equal to b. else: # We need to determine if a < b or a > b. # We can use the property of integer division for positive integers: # Since a and b are guaranteed to be natural numbers (1 <= a, b <= 10^8), # the integer division `a // b` will result in 0 if and only if a < b. # Check if a < b using integer division. # Python's `//` operator performs floor division. For positive integers, # this behaves the same as truncation towards zero. if a // b == 0: # If a // b is 0, it means a < b. Append the '<' character. results.append(char_lt) # If a is not equal to b, and `a // b` is not 0 (meaning a is not less than b), # then it must be the case that a > b. else: # Append the '>' character. results.append(char_gt) # After processing all pairs, print the results. # '\n'.join(results) concatenates all strings in the results list, # separated by newline characters, producing the required output format. print('\n'.join(results)) # Execute the main solution function when the script is run. solve()