UVA201 - Squares
来源:互联网 发布:淘宝 买家秀图 编辑:程序博客网 时间:2024/05/19 23:26
这个题比较水吧,控制好输出格式就好了。其他没有坑。
#include<cstdio>#include<cstring>#include<memory.h>typedef struct{ int h,v;}point;int main(){ //freopen("in.txt","r",stdin); int n,m,u=0; while(scanf("%d%d",&n,&m)==2){ if(u) printf("\n**********************************\n\n"); int i,j,k,s,t; point a[n][n]; memset(a,0,sizeof(a)); char c; for(i=0;i<m;i++){ getchar(); c=getchar(); scanf("%d%d",&s,&t); if(c=='H') a[s-1][t-1].h=1; if(c=='V') a[t-1][s-1].v=1; } printf("Problem #%d\n\n",++u); int can,out=0; for(k=1;k<n;k++){//边长 int num=0;//printf("%d=====\n",k); for(i=0;i<n-k;i++){//每个点情况 for(j=0;j<n-k;j++){ //printf("i=%d j=%d\n",i,j); can=1; for(s=i,t=j;t<j+k;t++){ if(a[s][t].h==0) can=0; } for(;s<i+k;s++){ if(a[s][t].v==0) can=0; } for(s=i,t=j;s<i+k;s++){ if(a[s][t].v==0) can=0; } for(;t<j+k;t++){ if(a[s][t].h==0) can=0; } if(can) num++; } } if(num) { printf("%d square (s) of size %d\n",num,k); out=1; } } if(out==0) printf("No completed squares can be found.\n"); } return 0;}
0 0
- UVA201 Squares
- UVA201 - Squares
- Uva201 Squares
- UVa201 Squares
- UVA201-Squares
- Uva201 Squares
- uva201 Squares 记录
- uva201正方形squares
- UVa201 Squares 解题报告
- UVA201(p96)----Squares
- 正方形(squares,UVa201)
- BFS:UVa201-Squares
- uva201(poj2445) Squares(模拟)
- 【ACM】Solution of UVA201-Squares
- UVa201
- UVa201
- uva201
- UVa201
- MongoDB学习笔记(三) 在MVC模式下通过Jqgrid表格操作MongoDB数据
- 用WebCollector 2.x爬取新浪微博(无需手动获取cookie)
- 2015-01-02
- go reflect TypeOf 与ValueOf
- 文本格式不变存放在数据库
- UVA201 - Squares
- c++实现Callback机制
- Java基础----UDP
- h2database源码浅析:SQL语句的执行
- 变量类型 15-1-2
- python 和 c++ 之间发消息用json
- 《gdb调试之基础篇》
- MongoDB学习笔记(四) 用MongoDB的文档结构描述数据关系
- 学习->linux多线程网址