結果
問題 |
No.293 4>7の世界
|
ユーザー |
![]() |
提出日時 | 2025-03-26 15:43:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 82,520 KB |
実行使用メモリ | 53,400 KB |
最終ジャッジ日時 | 2025-03-26 15:43:24 |
合計ジャッジ時間 | 1,936 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
A, B = input().split() def compare_custom(a_str, b_str): # Check if the lengths differ len_a, len_b = len(a_str), len(b_str) if len_a != len_b: return a_str if len_a > len_b else b_str # Compare each digit from left to right for a_digit, b_digit in zip(a_str, b_str): if a_digit == b_digit: continue # Handle 4 and 7 cases if (a_digit == '4' and b_digit == '7'): return a_str elif (a_digit == '7' and b_digit == '4'): return b_str else: # Standard comparison for other digits return a_str if a_digit > b_digit else b_str # The two numbers are equal (impossible as per problem constraints) return a_str result = compare_custom(A, B) print(result)