标签:blog io 使用 for 数据 sp div c log
假设:某个定单上的游客一旦被安排到某房间,在他预定住宿的期间内是不换房间的。为了简化描述,定单上的开始住宿时间为距离现在的第几天。例如,定单为(10,30,5)表示游客要求使用10个房间,第30天开始连住5天。
1 3 3 10 4 4 9 3 3 12 6
7
#include<stdio.h>
#include <memory.h>
int main()
{
int T,N,a,b,c,num[200],i,max;
scanf("%d",&T);
while(T--)
{
max=0;
memset(num,0,sizeof(num));
scanf("%d",&N);
while(N--)
{
scanf("%d%d%d",&a,&b,&c);
for(i=b;i<b+c;i++)
{
num[i]+=a;
if(num[i]>max)max=num[i];
}
}
printf("%d\n",max);
}
return 0;
}
标签:blog io 使用 for 数据 sp div c log
原文地址:http://www.cnblogs.com/dengshiwei/p/4008197.html