70分求助
  • 板块题目总版
  • 楼主封禁用户
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/8/28 21:36
  • 上次更新2024/8/29 09:19:03
查看原帖
70分求助
998963
封禁用户楼主2024/8/28 21:36

题目传送门

我的测评结果

This is my 代码

#include <iostream>
using namespace std;
int is_z(int);
int main()
{
	int n, a[110][110], s = 0, c = 0;
	cin >> n;
	for (int i = 1; i <= n; i ++)
	{
		for (int j = 1; j <= n; j ++)
		{
			cin >> a[i][j];
		}
	}
	for (int i = 1; i <= n; i ++)
	{
		for (int j = 1; j <= n; j ++)
		{
			if (is_z(a[i][j]))
			{
				s ++;
				if ((!is_z(a[i - 1][j])) || (!is_z(a[i + 1][j])) || (!is_z(a[i][j - 1])) || (!is_z(a[i][j + 1])))
				{
					c ++;
				}
		
		}
	}
	cout << s << " " << c;
	return 0;
 } 
 int is_z(int a)
 {
	if (a <= 50) return 1;
	else return 0;
 }
2024/8/28 21:36
加载中...