HDU5163Taking Bus(水题)
来源:互联网 发布:php 订单系统设计 编辑:程序博客网 时间:2024/06/05 11:35
用画图工具画画线段就能明显看出来
#include<cstdio>#include<stack>#include<cstring>#include<algorithm>#include<iostream>#include<math.h>using namespace std;__int64 shu[100010];int main(){ // freopen("G://test.txt","r",stdin); int t; int n,m; scanf("%d",&t); while(t--){ scanf("%d%d",&n,&m); shu[0]=0; for(int i=1;i<n;++i){ scanf("%I64d",&shu[i]); shu[i]=shu[i-1]+shu[i]; } for(int i=0;i<m;++i){ int x; int y; scanf("%d %d",&x,&y); __int64 sum=0; int now=(i)%n+1; if(y>x){ if(now>x){ sum=shu[n-1]-shu[now-1]+shu[n-1]+shu[y-1]; } else{ sum=shu[y-1]-shu[now-1]; } } else{ sum=shu[n-1]-shu[now-1]+shu[n-1]-shu[y-1]; } printf("%I64d\n",sum); } } return 0;}
0 0
- HDU5163Taking Bus(水题)
- HDU5163Taking Bus
- (未完成) Bus Pass
- bus
- BUS
- bus
- CodeForces 711A Bus to Udayland(水题)
- hdu 5163 Taking Bus 水题
- D-Bus讲解(一)
- hdu Bus System(floyd)
- Bus Hound简介(2)
- Event Bus 使用(一)
- 数据总线DB(Data Bus)、地址总线AB(Address Bus)和控制总线CB(Control Bus)
- ZOJ 2913 Bus Pass BFS水题
- codeforces 711A.Bus to Udayland 【水题】
- SMBus---------System Management Bus(系统管理总线)
- D-Bus学习(一):总体介绍
- D-Bus学习(二):基本概念
- redmine 学习记录
- c/c++环境搭建
- uva_1585_Score
- Struts 1 之配置文件
- 资源向导之 “Python beginner”
- HDU5163Taking Bus(水题)
- androguard安装和使用 (一)
- 04-4. 猜数字游戏(15)
- 05-0. 求序列前N项和(15)
- 中科燕园GIS外包团队促进信息资源共享
- 简单说说MapReduce, Tez, Spark
- NTU-Coursera机器学习:VC Bound和VC维度
- 【opencv】opencv在图片、视频嵌中英文字符的方法
- 05-1. 约分最简分式(15)