hdu 5024 枚举
来源:互联网 发布:易语言php网络验证 编辑:程序博客网 时间:2024/05/16 01:30
暴力枚举拐角即可..
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#define MAX 107using namespace std;int mp[MAX][MAX];int n,ans;struct Change{ int x1 , y1 , x2 , y2;}c[MAX];void init ( ){ c[1].x1 = -1 , c[1].y1 = 0; c[1].x2 = 0 , c[1].y2 = 1; c[2].x1 = -1 , c[2].y1 = 1; c[2].x2 = 1 , c[2].y2 = 1; c[3].x1 = 0 , c[3].y1 = 1; c[3].x2 = 1 , c[3].y2 = 0; c[4].x1 = 1 , c[4].y1 = 1; c[4].x2 = 1 , c[4].y2 = -1; c[5].x1 = 1 , c[5].y1 = 0; c[5].x2 = 0 , c[5].y2 = -1; c[6].x1 = 1 , c[6].y1 = -1; c[6].x2 = -1 , c[6].y2 = -1; c[7].x1 = 0 , c[7].y1 = -1; c[7].x2 = -1 , c[7].y2 = 0; c[8].x1 = -1 , c[8].y1 = -1; c[8].x2 = -1 , c[8].y2 = 1; }void out ( ){ for ( int i = 1 ; i <= n ; i++ ) { for ( int j = 1 ; j <= n ; j++ ) cout << mp[i][j] << " "; cout << endl; }}int main ( ){ init ( ); char ch; while ( ~scanf ( "%d" , &n ) , n ) { ans = 0; memset ( mp , 0 , sizeof ( mp ) ); for ( int i = 1 ; i <= n ; i++ ) { getchar(); for ( int j = 1 ; j <= n ; j++ ) { ch = getchar(); if ( ch == '.' ) mp[i][j] = 1; } } // out ( ); for ( int i = 1 ; i <= n ; i++ ) for ( int j = 1 ; j <= n ; j++ ) if ( mp[i][j] ) for ( int k = 1 ; k <= 8 ; k++ ) { // cout << "YES" << endl; /* cout << c[k].x1 << " " << c[k].y1 << " " << c[k].x2 << " " << c[k].y2 << endl;*/ int cnt = 1; for ( int t = 1 ;;t++ ) { /*cout << i+c[k].x1 *t << " " << j+c[k].y1 *t << endl;*/ if ( !mp[i+c[k].x1*t][j+c[k].y1*t] ) { cnt += (t-1); break; } } for ( int t = 1 ;; t++ ) { /* cout << i + c[k].x2*t << " " << j + c[k].y2*t << endl;*/ if ( !mp[i+c[k].x2*t][j+c[k].y2*t] ) { cnt += (t-1); break; } } // cout << "Okay" << endl; ans = max ( cnt , ans ); } printf ( "%d\n" , ans ); } }
0 0
- hdu 5024 暴力枚举
- hdu 5024 枚举
- hdu 3332 暴力枚举
- hdu 4007 枚举 Dave
- hdu 4068 枚举 SanguoSHA
- hdu 1015 Safecracker(枚举)
- hdu 1087 枚举+DP
- hdu 1158 枚举+DP
- hdu-1425(排序||枚举)
- HDU 4353 枚举
- HDU 3823 暴力枚举
- HDU 4380 预处理枚举
- hdu 4334 Trouble 枚举。。。。
- hdu 2208 DFS枚举
- HDU 3118 Arbiter(枚举)
- hdu 4152 dfs 枚举
- hdu 1015 Safecracker 枚举
- hdu 1015 枚举
- Android微信式底部标签栏和fragment切换实现
- FCKeditor html 文本编辑器的配置应用
- 即时通讯 音视频 开发技术
- 好记性不如烂笔头50-javaWeb框架struts2中的方法拦截器(5)
- 个人总结之类 Arrays类的常用方法
- hdu 5024 枚举
- 灰度图像--图像分割 Scharr算子
- Hash练习题:【HDOJ4821】--String【字符串hash】
- char*互相转换wchar_t*
- java验证iap支付收据
- ArrayList的实现原理
- 近期内容补漏
- LeetCode 24.Swap Nodes in Pairs
- 我的有效学习-----WPF学习初步