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 |
sdgfd#include <stdio.h> #include <iostream.h> #include <string.h> int a[100][100]={0}; void f1(int x,int y,int l){ int i,j; for(i=x-1;i<=x+l-2;i++){ for(j=y-1;j<=y+l-2;j++) a[i][j]=1; } } void f2(int x,int y,int l){ int i,j; for(i=x-1;i<=x+l-2;i++){ for(j=y-1;j<=y+l-2;j++) a[i][j]=0; } } void f3(int x,int y,int l){ int i,j,count=0; for(i=0;i<100;i++){ for(j=0;j<100;j++){ if(a[i][j]==1) count++; } } cout<<count<<endl; } void main(){ char order[100][10]={'0'}; int x,y,l; int t,i; cin>>t; for(i=0;i<t;i++){ cin>>order[i]>>x>>y>>l; if(strcmp(order[i],"BLACK")==0) f1(x,y,l); else { if(strcmp(order[i],"WHITE")==0) f2(x,y,l); else f3(x,y,l); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator