結果

問題 No.343 手抜き工事のプロ
ユーザー piconic_Xpiconic_X
提出日時 2016-03-16 00:49:56
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 869 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-08 14:13:58
合計ジャッジ時間 1,838 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 12 ms
6,548 KB
testcase_02 AC 12 ms
6,548 KB
testcase_03 AC 12 ms
6,548 KB
testcase_04 AC 12 ms
6,548 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 11 ms
6,548 KB
testcase_08 AC 11 ms
6,548 KB
testcase_09 AC 12 ms
6,548 KB
testcase_10 AC 13 ms
6,548 KB
testcase_11 AC 11 ms
6,548 KB
testcase_12 AC 12 ms
6,548 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 11 ms
6,548 KB
testcase_16 AC 11 ms
6,548 KB
testcase_17 AC 11 ms
6,548 KB
testcase_18 AC 11 ms
6,548 KB
testcase_19 AC 11 ms
6,548 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

import sys
import math

args = sys.stdin.readlines()
n = float(args[0])
hl = float(args[1]) / 2

def loop(i, prev_sum, n, cntr):
    xii = float(args[i+1])
    if i == 1:
        if math.fabs(float(args[i+1])) > 2*hl-1:
            return -1
        elif math.fabs(prev_sum) < hl and math.fabs(prev_sum - xii) < hl:
            return cntr
        else:
            return cntr+1
    else:
        xi = float(args[i])
        if math.fabs(xi - xii) > 2*hl-1:
            return -1
        elif math.fabs(prev_sum - xi) < hl and math.fabs(prev_sum - xii) < hl:
            new_sum = float((n-i)*prev_sum + xi)/(n-i+1)
            return loop(i-1, new_sum, n, cntr)
        else:
            new_sum = float((n-i)*prev_sum + xi)/(n-i+1)
            return loop(i-1, new_sum, n, cntr+1)


print loop( len(args)-2 , float(args[len(args)-1]), n, 0 )
0