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 |
Re:垃圾题目,奇怪的问题In Reply To:Re:垃圾题目,奇怪的问题 Posted by:BJ051155 at 2007-04-15 15:39:47 #include <iostream.h> int a[101][101]; int num; int x,y,l; void ch(int c) { for(int i=x;i<x+l;i++) for(int j=y;j<y+l;j++) a[i][j]=c; } int count() { int c=0; for(int i=1;i<101;i++) for(int j=1;j<101;j++) if(a[i][j]==1) c++; return c; } void main() { char cd[5]; cin>>num; for(int i=1;i<101;i++) for(int j=1;j<101;j++) a[i][j]=0; while(num--) { cin>>cd>>x>>y>>l; if(cd[0]=='B') ch(1); else if(cd[0]=='W') ch(0); else cout<<count()<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator