首页 > 其他 > 详细

AOJ 801.热身之蘸酱吃

时间:2016-03-24 01:00:20      阅读:219      评论:0      收藏:0      [点我收藏+]

直接强行模拟即可

 1 #include <cstdio>
 2 #include <algorithm>
 3 #include <cstring>
 4 #include <cmath>
 5 #include <string>
 6 #include <iostream>
 7 #include <vector>
 8 #include <list>
 9 #include <stack>
10 using namespace std;
11  
12 #define REP(n) for(int o=0;o<n;o++)
13  
14 const int maxn = 1005;
15 int w[maxn];
16  
17 bool Do() {
18     int n,m,T;
19     if(scanf("%d%d%d",&n,&m,&T) == EOF)
20         return false;
21     REP(n)
22         scanf("%d",&w[o+1]);
23     REP(m) {
24         int l,r,k;
25         scanf("%d%d%d",&l,&r,&k);
26         for(;l <= r;l++)
27             w[l] += k;
28     }
29     REP(T) {
30         int L,R;
31         int ans=0;
32         scanf("%d%d",&L,&R);
33         for(;L <= R;L++)
34             ans += w[L];
35         printf("%d\n",ans);
36     }
37     return true;
38 }
39  
40 int main() {
41     while(Do());
42     return 0;
43 }

 

AOJ 801.热身之蘸酱吃

原文:http://www.cnblogs.com/ohyee/p/5313741.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!