UESTC
来源:互联网 发布:音乐合成软件 编辑:程序博客网 时间:2024/06/04 20:06
Post office
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
There are
Input
For each test case, the first line is EOF
. Total number of test case is no more than
Be careful, the position of two villages may be the same.
Output
For every query of each test case, you tell the minimum sum.
Sample input and output
31 2 321 32 3
21
#include <bits/stdc++.h>using namespace std;int n, m;int a[10001];int main(){ while(scanf("%d", &n) == 1){ for(int i = 1; i <= n; i++){ scanf("%d", &a[i]); } scanf("%d", &m); while(m--){ int l, r; int ans = 0; scanf("%d%d", &l, &r); while(l <= r){ ans += a[r]-a[l]; r--, l++; } printf("%d\n", ans); } }}
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- hdu 6092 Rikka with Subset(多重背包)
- 接口
- Leetcode题解 53. Maximum Subarray 思路解析
- 算法模板之快速幂取模
- stm32 红外
- UESTC
- Android OTA升级原理和流程分析(五)---update.zip包从上层进入Recovery服务
- Oracle中通过substr和instr实现截取指定字符之间的字符串:
- 面试问题
- [WebGL入门]二十九,透明混色
- Linux实用命令整理
- Android-PickerView 说明文档(API)
- ionic3 实现扫码功能
- Android任务栈和启动模式