結果

問題 No.111 あばばばば
ユーザー kichirb3kichirb3
提出日時 2018-03-05 22:40:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-10-11 20:34:25
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,880 KB
testcase_01 AC 15 ms
7,972 KB
testcase_02 AC 16 ms
7,808 KB
testcase_03 AC 15 ms
7,792 KB
testcase_04 AC 15 ms
7,976 KB
testcase_05 AC 15 ms
7,872 KB
testcase_06 AC 15 ms
7,796 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 16 ms
7,956 KB
testcase_09 AC 16 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.111 あばばばば
https://yukicoder.me/problems/no/111

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    """
    L = 9 の時、文字列は ababababa になる。この中には
    3文字の回文が (9-3+1) = 7個
    5文字の回文が (9-5+1) = 5個
    7文字の回文が (9-7+1) = 3個
    9文字の回文が (9-9+1) = 1個
    できる。

    ans = 0
    for i in range(3, L+1, 2):
        ans += (L - i + 1)
    print(ans)
    """
    L = int(input())
    ans = (1 + L-3+1) * (L - 1) // 2 // 2
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0