字母阵列(18JavaC3)

标题:字母阵列

仔细寻找,会发现:在下面的8x8的方阵中,隐藏着字母序列:"LANQIAO"。

SLANQIAO

ZOEXCCGB

MOAYWKHI

BCCIPLJQ

SLANQIAO

RSFWFNYA

XIFZVWAL

COAIQNAL

我们约定: 序列可以水平,垂直,或者是斜向;

并且走向不限(实际上就是有一共8种方向)。

上图中一共有4个满足要求的串。

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

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

FOAIQNALWIKEGNICJWAOSXDHTHZPOLGYELORAUHOHCZIERPTOOJUITQJCFNIYYQHSBEABBQZPNGYQTCLSKZFCYWDGOAIADKLSNGJ

GSOZTQKCCSDWGUWAUOZKNILGVNLMCLXQVBJENIHIVLRPVVXXFTHQUXUAVZZOFFJHYLMGTLANQIAOQQILCDCJERJASNCTLYGRMHGF

TSDFYTLVIBHKLJVVJUDMKGJZGNNSTPVLCKTOFMUEUFSVQIAUVHNVFTGBDDARPKYNNCUOYUAZXQJNOEEYKLFRMOEMHUKJTPETHLES

FKVINSLWEVGAGMKVFVIUBMYOIAFHLVNKNTYKTZWVXQWRWIGPENFXYDTKRVPKRTHMGHVYOCLDCKMEKRLGEKBYUCLOLYPAKPFSOREH

KWPUOLOVMOFBIXYACWRDYBINTMPASPCEOKHXQIGBQQMCEOIVULIEOPFSCSIHENAJCVDPJDOIWIIULFDNOZOFVAMCABVGKAKCOZMG

XWMYRTAFGFOCNHLBGNGOXPJSTWLZUNNAGIRETGXFWAQSSJPFTQAXMTQWMZWYVEPQERKSWTSCHSQOOBGXAQTBCHOEGBDVKGWJIFTG

ZWWJEIISPLMXIMGHOOGDRZFTGNDDWDWMNUFWJYJGULPHNUFSAQNNIUVAAFZIAZKFXXNWCEABGJAUMGYEIEFVQXVHHHEDYUITRCQB

XZHDPZQTOBECJVBZLACVXACZEDYOGVAVQRNWEOWGRAQYUEUESTEDQTYJUTEFOOITSHDDZHONJGBRCWNEQLZUTBNQIADKNFIOMWZR

EBFKCV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BBZYNCVERJGSKLWZEKGJBCWMSMLYIHZFFMIOGVIMZQBSRHQWAADYN

MNXEGTDXCDKIUDOISQXEUJWETPELKBCYFSDNJQWNNBPYMWBUPQBAAINMYZOYCEGNLFNNHZFEMSQVXJJGWBCRAVKZFWFBKMBRVBFD

HKACSZIUWUXLWKFPKOCUQJEPQDZCMUJFLVCLIOQQRVKSWFIAKNHMRLNJTKGVNTGLCVPVMBLJANOBCXUGVWBJYSIXZQVAVFWILWFB

QWNLTPMCYHRSKVHXLONRANWKWXUTHYQLIOFKGDBMSWDRCYRKVSAGGRJMWQYQFLMUIGGCLAUQAACTYLPZEOJBHMWRKHCRXGTGRMUP

CPQKJRBLYDNPUGHCRBVYBAIRVCAWLBWVWCMKNBIRKJOUGYQEBQRHDSTWXDIWGRVMLIJFBWHLHCDAAVUDLZSCGQNOUXVUIVIZZZMD

NMHGYPFUUDWKQGTAKKGCDFJFYJFNRZVXDPGZEAMWQVQZODKTXHIYFVKJSSAWVHYCUCZMLLBPXTILDYJQEMWDRUFKISOUVPUDTYPB

FDAQUBXHUJYTAYNWVIJNUSQDTQDEMUAPWXRYUWONTBDZCHZOUEGPMWEZTQWWSHAYOBWVTDIMZYNVNZKUHOFCQKPHJXWNRCGUJEKO

WSDAUGUTVWCVHEMOIRJJGTANUWTSAIXXEVZTBDHPGSRHHVWCDZVZYRJTLONIJVXEATHQXOUKBIGZONFRSZIOGWNTYAJYLQCGEOWY

请提交一个整数,不要填写任何多余的内容。

参考答案:

41

参考代码:

package bb;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class JC18_3字母阵列 {
static char[][] arr2D = new char[100][100];
static int count = 0;
public static void main(String[] args) throws IOException {
// 读入文件
FileReader fr = new FileReader("JavaC3.txt");
BufferedReader br = new BufferedReader(fr);
String sLine;
int lineNo = 0;
while ((sLine = br.readLine()) != null) {
arr2D[lineNo] = sLine.toCharArray();
lineNo++;
}
br.close();
fr.close();
// 打印二维数组
for (int i = 0; i < arr2D.length; i++) {
System.out.println(Arrays.toString(arr2D[i]));
}
// 匹配
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
if (arr2D[i][j] == 'L') {
fun(i, j);
}
}
}
System.out.println(count);
}
static void fun(int x, int y) {
boolean state;
String str = "LANQIAO";
int a, b, index;
// 向上
state = true;
a = x;
b = y;
index = 1;
if (x >= 6) {
while (state && index < 7) {
a--;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "向上");
count++;
}
}
// 向下
state = true;
a = x;
b = y;
index = 1;
if (x <= 93) {
while (state && index < 7) {
a++;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "向下");
count++;
}
}
// 向左
state = true;
a = x;
b = y;
index = 1;
if (y >= 6) {
while (state && index < 7) {
b--;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "向左");
count++;
}
}
// 向右
state = true;
a = x;
b = y;
index = 1;
if (y <= 93) {
while (state && index < 7) {
b++;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "向右");
count++;
}
}
// 左上
state = true;
a = x;
b = y;
index = 1;
if (x >= 6 && y >= 6) {
while (state && index < 7) {
a--;
b--;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "左上");
count++;
}
}
// 右上
state = true;
a = x;
b = y;
index = 1;
if (x >= 6 && y <= 93) {
while (state && index < 7) {
a--;
b++;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "右上");
count++;
}
}
// 左下
state = true;
a = x;
b = y;
index = 1;
if (x <= 93 && y >= 6) {
while (state && index < 7) {
a++;
b--;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "左下");
count++;
}
}
// 右下
state = true;
a = x;
b = y;
index = 1;
if (x <= 93 && y <= 93) {
while (state && index < 7) {
a++;
b++;
if (arr2D[a][b] == str.charAt(index)) {
index++;
} else {
state = false;
}
}
if (index == 7) {
System.out.println(x + " " + y + "右下");
count++;
}
}
}
}

蓝桥杯——字母阵列(2018JavaC组第3题)的更多相关文章

  1. Java实现第九届蓝桥杯字母阵列

    字母阵列 题目描述 仔细寻找,会发现:在下面的8x8的方阵中,隐藏着字母序列:"LANQIAO". SLANQIAO ZOEXCCGB MOAYWKHI BCCIPLJQ SLAN ...

  2. 蓝桥杯——复数幂 (2018JavaAB组第3题)

    18年Java蓝桥杯A组第3题和B组是一样的. 第三题往往比较难. 复数幂 (18JavaAB3) (A.B两卷第三题一样) 设i为虚数单位.对于任意正整数n,(2+3i)^n 的实部和虚部都是整数. ...

  3. 蓝桥杯——快速排序(2018JavaB组第5题9分)

    快速排序(18JavaB5,9') 以下代码可以从数组a[]中找出第k小的元素. 它使用了类似快速排序中的分治算法,期望时间复杂度是O(N)的. 请仔细阅读分析源码,填写划线部分缺失的内容. impo ...

  4. 蓝桥杯——分组比赛(2017JavaB组第3题)

    分组比赛(17JavaB3) 9名运动员参加比赛,需要分3组进行预赛. 有哪些分组的方案呢? 标记运动员为 A,B,C,... I 下面的程序列出了所有的分组方法: ABC DEF GHI ABC D ...

  5. 第七届蓝桥杯省赛javaB组 第七题剪邮票

    剪邮票 如[图1.jpg], 有12张连在一起的12生肖的邮票.现在你要从中剪下5张来,要求必须是连着的.(仅仅连接一个角不算相连)比如,[图2.jpg],[图3.jpg]中,粉红色所示部分就是合格的 ...

  6. 2015年蓝桥杯省赛B组第3题--三羊献瑞

    三羊献瑞 观察下面的加法算式: 祥 瑞 生 辉   +   三 羊 献 瑞 -------------------    三 羊 生 瑞 气 (如果有对齐问题,可以参看[图1.jpg]) 其中,相同的 ...

  7. 蓝桥杯——螺旋折线(2018JavaB组第7题19分)

    螺旋折线(18JB-7-19') 如图p1.pgn所示的螺旋折线经过平面上所有整点恰好一次. 对于整点(X, Y),我们定义它到原点的距离dis(X, Y)是从原点到(X, Y)的螺旋折线段的长度. ...

  8. 第七届蓝桥杯省赛JavaB组——第十题压缩变换

    题目: 压缩变换小明最近在研究压缩算法.他知道,压缩的时候如果能够使得数值很小,就能通过熵编码得到较高的压缩比.然而,要使数值很小是一个挑战.最近,小明需要压缩一些正整数的序列,这些序列的特点是,后面 ...

  9. 52-2018 蓝桥杯省赛 B 组模拟赛(一)java

    最近蒜头君喜欢上了U型数字,所谓U型数字,就是这个数字的每一位先严格单调递减,后严格单调递增.比如 212212 就是一个U型数字,但是 333333, 9898, 567567, 313133131 ...

随机推荐

  1. 在国内使用Google验证码reCaptcha

    如今各大网站都不可缺少的一部分就是验证码,验证码具有防止恶意批量操作,保护账户安全等作用.但是现在各种暴力破解验证码的手段层出不穷,验证码的保护也就失去了意义.所以各大平台为了应对这种情况也是使用类似 ...

  2. MySql基础(常用)

    MySQL常用语句 1.查看当前所有数据库 show databases; 2.打开指定的库 use 库名; 3.查看当前库中的所有表 show tables; 4.查看其他库的表 show tabl ...

  3. VisualCalendar-可视化日历的创建

    public class VisualCalendar { public static void main(String[]args){ System.out.println("请输入日期( ...

  4. MyBatis 原理浅析——基本原理

    前言 MyBatis 是一个被广泛应用的持久化框架.一个简单的使用示例如下所示,先创建会话工厂,然后从会话工厂中打开会话,通过 class 类型和配置生成 Mapper 接口的代理实现,最后使用 Ma ...

  5. Python3网络学习案例三:编写web server

    1. 写在前面 这里总结的并不够详细,有时间了再进行补充. 2. 设计思路 HTTP协议是建立在TCP上的1. 建立服务器端TCP套接字(绑定ip,port),等待监听连接:listen(2. 打开浏 ...

  6. Android Google官方文档解析之——Device Compatibility

    Android is designed to run on many different types of devices, from phones to tablets and television ...

  7. LDA与PCA

    参考: https://www.cnblogs.com/pinard/p/6244265.html https://blog.csdn.net/qq_25680531/article/details/ ...

  8. Docker系列01—Docker 基础入门

    一.初识Docker和容器 1.1 什么是docker 容纳其他物品的工具,可以部分或完全封闭,被用于容纳.存储.运输物品.物体可以被放置在容器中,而容器则可以保护内容物. 容器? 容器就是在隔离的环 ...

  9. [MIT6.006] 4. Heaps and Heap Sort 堆,堆排序

    第4节课仍然是讲排序,但介绍的是一种很高效的堆排序. 在编程过程中,有时候会需要进行extrat_max的操作,即从一个数列里挨个抽取最大值并将其它从原数列中移除.而排序问题也可以看作是一个extra ...

  10. 04 . Vue组件注册,数据交互,调试工具及组件插槽介绍及使用

    vue组件 组件(Component)是 Vue.js 最强大的功能之一. 组件可以扩展 HTML 元素,封装可重用的代码. 组件系统让我们可以用独立可复用的小组件来构建大型应用,几乎任意类型的应用的 ...