Codeforces Problem 332B: Backward Linear Scan
来源:互联网 发布:软件企业免税 编辑:程序博客网 时间:2024/06/18 17:34
http://codeforces.com/problemset/problem/332/B
Solution (Python Codes)
n, k = (int(x) for x in input().split())x = [int(x) for x in input().split()]s = [0]for i in range(n):s.append(s[i] + x[i])a = n - k - k + 1sa = s[n - k] - s[a - 1]b = n - k + 1sb = s[n] - s[b - 1]ans = sa + sbansa = aansb = bib = bwhile a > 1:a -= 1sa = s[a + k - 1] - s[a - 1]b -= 1tb = s[b + k - 1] - s[b - 1]if tb >= sb:sb = tbib = bif sa + sb >= ans:ansa = aansb = ibans = sa + sbprint(ansa, ansb)
- Codeforces Problem 332B: Backward Linear Scan
- Codeforces Problem 332B
- Codeforces Gym 100889 B Backward and Forward
- Problem - 216B - Codeforces
- Problem - 218B - Codeforces
- codeforces problem/408/B
- Codeforces Problem - 50B
- Problem - 376B - Codeforces
- problem - 616B -codeforces
- Codeforces Problem 333B
- codeforces-Problem 193B - Xor
- Codeforces Problem 499B. Lecture
- codeforces 278B New Problem
- Codeforces Problem - 617B Chocolate
- Problem--158B--Codeforces--Taxi
- codeforces 782/problem/B [二分]
- codeforces/contest/797/problem/B
- codeforces/contest/798/problem/B
- POJ 1258 Agri-Net
- PAT (Basic Level) Practise 1001-1010全部题解
- x264编码在zedboard上的实现(软编码)(四)
- iOS中UITextField 使用全面解析
- hdu 4614 多校联赛第二场 1004题
- Codeforces Problem 332B: Backward Linear Scan
- Assignment 2: Mathematics
- 关于android 开关机动画
- HDU 4612 Warm up 解题报告
- vc++ resource.h文件出现“fatal error RC1004: unexpected end of file found”问题
- IOS_将GPS等EXIF信息写进任意JPEG图片(不依托UIImagePickerController)
- JavaWeb应用开发架构浅谈
- 万恶的 rm -rf 啊!使用 extundelete 恢复!
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果,滤波,图像截取) 对图片的处理 : 亮度调整 抓屏 翻转 随鼠标画矩形