比赛 |
NOIP模拟赛1 |
评测结果 |
AAAAAATTTTTTTTTTTTTT |
题目名称 |
天天爱射击 |
最终得分 |
30 |
用户昵称 |
FYJ |
运行时间 |
14.027 s |
代码语言 |
C++ |
内存使用 |
0.28 MiB |
提交时间 |
2018-02-08 21:34:13 |
显示代码纯文本
- #include<bits/stdc++.h>
- using namespace std;
- int n,m,used[1005];
- struct node{
- int x1,x2,s;
- }t[1005];
- inline void init(){
- freopen("shooting.in","r",stdin);
- freopen("shooting.out","w",stdout);
- }
- inline void end(){
- fclose(stdin);
- fclose(stdout);
- }
- int main(){
- init();
- scanf("%d%d",&n,&m);
- for(int i=1;i<=n;++i){
- scanf("%d%d%d",&t[i].x1,&t[i].x2,&t[i].s);
- }
- for(int i=1;i<=m;++i){
- int x,sum=0;
- scanf("%d",&x);
- for(int j=1;j<=n;++j){
- if(t[j].s>0){
- if(x>=t[j].x1&&x<=t[j].x2){
- t[j].s--;
- if(t[j].s==0)sum++;
- }
- }
- }
- printf("%d\n",sum);
- }
- end();
- return 0;
- }