結果

問題 No.112 ややこしい鶴亀算
ユーザー MamonboMamonbo
提出日時 2015-10-03 18:44:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-27 01:49:58
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 15 ms
7,836 KB
testcase_03 AC 15 ms
7,776 KB
testcase_04 AC 15 ms
7,984 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 15 ms
7,928 KB
testcase_07 AC 15 ms
7,932 KB
testcase_08 AC 16 ms
7,940 KB
testcase_09 AC 16 ms
7,812 KB
testcase_10 AC 15 ms
7,932 KB
testcase_11 AC 15 ms
7,860 KB
testcase_12 AC 15 ms
7,724 KB
testcase_13 AC 15 ms
7,968 KB
testcase_14 AC 15 ms
7,804 KB
testcase_15 AC 15 ms
7,772 KB
testcase_16 AC 15 ms
7,772 KB
testcase_17 AC 15 ms
7,772 KB
testcase_18 AC 15 ms
7,832 KB
testcase_19 AC 15 ms
7,952 KB
testcase_20 AC 15 ms
7,912 KB
testcase_21 AC 15 ms
7,840 KB
testcase_22 AC 15 ms
7,932 KB
testcase_23 AC 15 ms
7,968 KB
testcase_24 AC 15 ms
7,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8

N=int(input())
#総当たりの表をイメージするとよい
#報告された足の本数を足し合せるとN*N-N匹の本数を数えられる
#N-1で割れば本当の足の本数が求まる
#本当の足の本数-報告した足の本数=観測者の足(数え忘れ)の本数
mojir=input()
hyo=mojir.split(' ')
a=[int(mono) for mono in hyo]

realsum=sum(a)//(N-1)
kame=0
turu=0
for idx in range(0,N,1):
    ashi=realsum-a[idx]
    if ashi==2:
        turu=turu+1
    elif ashi==4:
        kame=kame+1

print('{turu} {kame}'.format(turu=turu,kame=kame))
    
0