結果

問題 No.1934 Four Fruits
ユーザー lam6er
提出日時 2025-04-09 20:57:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 518 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2025-04-09 20:59:37
合計ジャッジ時間 1,163 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int, input().split())

freq = {}
for x in (a, b, c):
    freq[x] = freq.get(x, 0) + 1

if len(freq) == 1:
    print(a)
else:
    max_count = max(freq.values())
    if max_count == 2:
        # Find the element with count 1
        for key, count in freq.items():
            if count == 1:
                print(key)
                break
    else:
        # All three are different, find missing one
        for i in range(4):
            if i not in freq:
                print(i)
                break
0