From 4ac65940e064c5b587699549a0c7277d2dd733a8 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 20 Jun 2017 15:11:08 +0700 Subject: Thầy Nguyễn Thanh Tùng ôn THT XXIII MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- others/other/express.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 others/other/express.py (limited to 'others/other/express.py') diff --git a/others/other/express.py b/others/other/express.py new file mode 100755 index 0000000..70b8316 --- /dev/null +++ b/others/other/express.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +with open('express.inp') as fi, open('express.out', 'w') as fo: + a = tuple(map(int, fi.read().split()))[1:] + print(max( + sum(a[:i]) + a[i]*a[i+1] + sum(a[i+2:j]) + a[j]*a[j+1] + sum(a[j+2:]) + for i in range(len(a) - 3) for j in range(i + 2, len(a) - 1)), file=fo) -- cgit 1.4.1