您的位置:首页 > 大数据 > 人工智能

CF 272 C. Dima and Staircase

2013-02-20 11:11 302 查看
简单大水题,胡乱比较就可以:

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=100002;
ll h[maxn],hi,wi,mx;
int n,m;
int main()
{
//freopen("D://input.txt","r",stdin);
while(scanf("%d",&n)!=EOF)
{
int i,j;
for(mx=i=0;i<n;i++)cin>>h[i+1];
scanf("%d",&m);
while(m--)
{
cin>>wi>>hi;
mx=max(mx,h[wi]);
cout<<mx<<endl;
mx=mx+hi;
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: