首页 > 字符框
头像 牛客875000507号
发表于 2020-01-16 11:12:06
思路:.....第一眼看题目首先想到的是暴力枚举。设置两个计数变量count和Count,用来记录是否满足条件“face”全部存在以及满足条件字符框的总数。在(i,j)、(i+1,j)、(i,j+1)、(i+1,j+1)中如果存在'f'/'a'/'c'/'e'那么count+1;当满足count的值 展开全文
头像 小嗷犬
发表于 2023-07-31 15:11:38
判断含有 face 四个字符的 2*2 字符框的个数,判断方法不止一种。 n*m 的区域中,有 (n - 1) * (m - 1) 个 2*2 的字符框,遍历时应注意范围,不要越界。 4 次 if #include <bits/stdc++.h> using namespace std; 展开全文
头像 Cia11o
发表于 2021-05-22 21:01:03
水题 直接暴力模拟 #include <iostream> #include <cstring> #include <algorithm> #include <string> using namespace std; int n, m; st 展开全文
头像 小卢code
发表于 2022-01-23 21:45:37
#include<iostream> using namespace std; int main() { char a[50][50]; int n,m,sum=0; cin>>n>>m; for(int i=0;i<n;i++) { for 展开全文
头像 黎明rj
发表于 2020-02-09 12:17:21
字符框 遍历整个字符数组即可,注意范围 #include <cstring> #include <iostream> using namespace std; char map[100][100]; void print(int n, int m) { for 展开全文
头像 爱吃香菜的你选钝角
发表于 2025-01-07 23:13:28
#include <stdio.h> int main() {     int n, m;  // 定义网格的行数和列数    &nbs 展开全文
头像 Seudama
发表于 2021-06-22 23:36:25
就是暴力枚举啦 #include <iostream>#include <cstring>using namespace std; char ch[50][50]; int main(){ int n, m, sum = 0; bool face[6]; cin &g 展开全文
头像 装糊涂高手_
发表于 2023-01-03 19:11:17
思路 遍历字符数组,考虑以当前遍历字符为左上元素的2*2矩阵是否符合规则即可 #include <bits/stdc++.h> using namespace std; int n,m,cot,res = 0; char car[52][52]; bool jgface(int x,i 展开全文
头像 天元之弈
发表于 2022-03-19 09:26:44
#include<iostream> using namespace std; const int N=55; char a[N][N]; bool check(int x,int y){//check函数可能写的有点长 int flagf=0,flaga=0,flagc=0,f 展开全文
头像 努力学好计算机
发表于 2025-03-05 21:59:31
暴力方法 ">using namespace std; #define int long long #define endl '\n' signed main(){ ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n,m 展开全文