結果

問題 No.21 平均の差
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-10-16 16:26:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-05-02 02:21:24
合計ジャッジ時間 1,179 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
12,928 KB
testcase_01 AC 32 ms
12,928 KB
testcase_02 AC 34 ms
12,928 KB
testcase_03 AC 34 ms
12,928 KB
testcase_04 AC 33 ms
13,056 KB
testcase_05 AC 34 ms
12,928 KB
testcase_06 AC 35 ms
13,056 KB
testcase_07 AC 36 ms
13,056 KB
testcase_08 AC 36 ms
12,800 KB
testcase_09 AC 37 ms
12,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sqlite3


def main():
    connection = sqlite3.connect(":memory:")
    cursor = connection.cursor()
    cursor.execute("CREATE TABLE sequence(item INTEGER)")
    n = int(input())
    _ = input()
    xs = ((int(input()), ) for _ in range(n))
    cursor.executemany("INSERT INTO sequence VALUES (?)", xs)
    connection.commit()
    max_x = cursor.execute("SELECT max(item) FROM sequence").fetchone()[0]
    min_x = cursor.execute("SELECT min(item) FROM sequence").fetchone()[0]
    print(max_x - min_x)
    connection.close()


if __name__ == '__main__':
    main()
0