PersonalCorpus 版 (精华区)
1122044 2002/09/27 08:15:10.244 Accepted 0:01.830
4504 18188 C++ 10360 - Rat Attack
void main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\0acm\\uva\\contest9-13\\inputH.txt","r",stdin);
freopen("c:\\0acm\\uva\\contest9-13\\outputH.txt","w",stdout);
#endif
int sum[1025][1025];
int i,j,k,t,d,n,a,b,c;
scanf("%d\n",&t);
while (t>0) {
t--;
scanf("%d\n",&d);
scanf("%d\n",&n);
memset(sum,0,sizeof(sum));
for (i=0;i<n;i++) {
scanf("%d%d%d\n",&a,&b,&c);
for (j=a-d;j<=a+d;j++) if ((j>=0)&&(j<=1024))
for (k=b-d;k<=b+d;k++) if ((k>=0)&&(k<=1024))
sum[j][k]+=c;
}
k=0;
for (i=0;i<1025;i++)
for (j=0;j<1025;j++) if (sum[i][j]>k) {
k=sum[i][j];
a=i;b=j;
}
printf("%d %d %d\n",a,b,k);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.469毫秒