蓝桥杯字母阵列

字母阵列

  • 仔细寻找,会发现:在下面的8x8的方阵中,隐藏着字母序列:“LANQIAO”。
    SLANQIAO
    ZOEXCCGB
    MOAYWKHI
    BCCIPLJQ
    SLANQIAO
    RSFWFNYA
    XIFZVWAL
    COAIQNAL
    我们约定: 序列可以水平,垂直,或者是斜向;
    并且走向不限(实际上就是有一共8种方向)。
    上图中一共有4个满足要求的串。

下面有一个更大的(100x100)的字母方阵。

FOAIQNALWIKEGNICJWAOSXDHTHZPOLGYELORAUHOHCZIERPTOOJUITQJCFNIYYQHSBEABBQZPNGYQTCLSKZFCYWDGOAIADKLSNGJ
GSOZTQKCCSDWGUWAUOZKNILGVNLMCLXQVBJENIHIVLRPVVXXFTHQUXUAVZZOFFJHYLMGTLANQIAOQQILCDCJERJASNCTLYGRMHGF
TSDFYTLVIBHKLJVVJUDMKGJZGNNSTPVLCKTOFMUEUFSVQIAUVHNVFTGBDDARPKYNNCUOYUAZXQJNOEEYKLFRMOEMHUKJTPETHLES
FKVINSLWEVGAGMKVFVIUBMYOIAFHLVNKNTYKTZWVXQWRWIGPENFXYDTKRVPKRTHMGHVYOCLDCKMEKRLGEKBYUCLOLYPAKPFSOREH
KWPUOLOVMOFBIXYACWRDYBINTMPASPCEOKHXQIGBQQMCEOIVULIEOPFSCSIHENAJCVDPJDOIWIIULFDNOZOFVAMCABVGKAKCOZMG
XWMYRTAFGFOCNHLBGNGOXPJSTWLZUNNAGIRETGXFWAQSSJPFTQAXMTQWMZWYVEPQERKSWTSCHSQOOBGXAQTBCHOEGBDVKGWJIFTG
ZWWJEIISPLMXIMGHOOGDRZFTGNDDWDWMNUFWJYJGULPHNUFSAQNNIUVAAFZIAZKFXXNWCEABGJAUMGYEIEFVQXVHHHEDYUITRCQB
XZHDPZQTOBECJVBZLACVXACZEDYOGVAVQRNWEOWGRAQYUEUESTEDQTYJUTEFOOITSHDDZHONJGBRCWNEQLZUTBNQIADKNFIOMWZR
EBFKCVNLURZSNPOLTISRPDTN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KGJBCWMSMLYIHZFFMIOGVIMZQBSRHQWAADYN
MNXEGTDXCDKIUDOISQXEUJWETPELKBCYFSDNJQWNNBPYMWBUPQBAAINMYZOYCEGNLFNNHZFEMSQVXJJGWBCRAVKZFWFBKMBRVBFD
HKACSZIUWUXLWKFPKOCUQJEPQDZCMUJFLVCLIOQQRVKSWFIAKNHMRLNJTKGVNTGLCVPVMBLJANOBCXUGVWBJYSIXZQVAVFWILWFB
QWNLTPMCYHRSKVHXLONRANWKWXUTHYQLIOFKGDBMSWDRCYRKVSAGGRJMWQYQFLMUIGGCLAUQAACTYLPZEOJBHMWRKHCRXGTGRMUP
CPQKJRBLYDNPUGHCRBVYBAIRVCAWLBWVWCMKNBIRKJOUGYQEBQRHDSTWXDIWGRVMLIJFBWHLHCDAAVUDLZSCGQNOUXVUIVIZZZMD
NMHGYPFUUDWKQGTAKKGCDFJFYJFNRZVXDPGZEAMWQVQZODKTXHIYFVKJSSAWVHYCUCZMLLBPXTILDYJQEMWDRUFKISOUVPUDTYPB
FDAQUBXHUJYTAYNWVIJNUSQDTQDEMUAPWXRYUWONTBDZCHZOUEGPMWEZTQWWSHAYOBWVTDIMZYNVNZKUHOFCQKPHJXWNRCGUJEKO
WSDAUGUTVWCVHEMOIRJJGTANUWTSAIXXEVZTBDHPGSRHHVWCDZVZYRJTLONIJVXEATHQXOUKBIGZONFRSZIOGWNTYAJYLQCGEOWY

你能算出其中隐藏了多少个“LANQIAO”吗?

package _09第九届;

import java.util.Scanner;

public class Test03字母列阵 {
    static final int N=100;
    static char [][] data =new char[N][N];//字符矩阵
    static final char[]src= {'L','A','N','Q','I','A','O'};//要查找的数
    static int []dx= {1,1,0,-1,-1,-1,0,1};//八个方向
    static int []dy= {0,1,1,1,0 -1,-1,-1};//八个方向
    static int ans;  //出现次数
	public static void main(String[] args) {
		// TODO Auto-generated method stub
   Scanner sc=new Scanner(System.in);
   for(int i=0;i<N;i++) {
	   data[i]=sc.nextLine().toCharArray();//将字符串转化为数组
   }
   //做双重循环
   for(int i=0;i<N;i++) {
	   for(int j=0;j<N;j++) {
		   if(data[i][j]=='L'){
			   cheak(i,j);//找到了开头(检查)
		   }
	   }
   }
   System.out.println(ans);
	}

	// 检查八个方向
	private static void cheak(int x, int y) {
		// TODO Auto-generated method stub
		for (int d = 0; d < 8; d++) {// 展开八个方向
			int _x = x + dx[d];
			int _y = y + dy[d]; // 形成新的x和新的y
			int i = 1; // 作完寻找lanqiao的下标

			while (_x < N && _x >= 0 && _y < N && _y >= 0 && data[_x][_y] == src[i]) {// 检查边界
				if (i == 6) {// 找完成一个进行加一结束
					ans++;
					break;
				}
				i++; // 继续寻找下一个(走直线)
				_x += dx[d];
				_y += dy[d];
			}
		}
	}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

金石不渝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值