Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
tle啊!#include<stdio.h> int a[1001][1001]={0}; main() { int n,m,k,i,j,x,y,t,e=0; scanf("%d",&t); while(t--) { e++; int count=0; scanf("%d%d%d",&n,&m,&k); for(i=1;i<=n;i++) for(j=1;j<=m;j++) a[i][j]=0; while(k--) { scanf("%d%d",&x,&y); a[x][y]=1; } for(i=1;i<=n;i++) for(j=1;j<=m;j++) if(a[i][j]==1) { for(x=i+1;x<=n;x++) for(y=j-1;y>=0;y--) if(a[x][y]==1) count++; } printf("Test case %d: %d\n",e,count); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator