蒟蒻CE求助,怎么改
查看原帖
蒟蒻CE求助,怎么改
385874
_Miku_楼主2021/10/10 14:35
#include <bits/stdc++.h>
using namespace std;
int n,l,h;
int q = 1,a[30001][30001];
int main()
{
	cin >> n;
	cin >> h >> l;
	int t = n / 2;
	if(n % 2 == 1) t++;
	for(int i = 0;i < t;i++)
	{
		for(int j = i;j < n-i;j++)
		{
            a[i][j] = q++;
        }
        for(int j = i+1;j < n-i-1;j++)
		{
            a[j][n-i-1] = q++;
        }
        for(int j = n-i-1;j > i;j--)
		{
            a[n-i-1][j] = q++;
        }
        for(int j = n-i-1;j > i;j--)
		{
            a[j][i] = q++;
        }
	}
//	for(int i = 0;i < n;i++)
//	{
//		for(int j = 0;j < n;j++)
//		{
//			cout << a[i][j] << ' ';
//		}
//		cout << endl;
//	}
	cout << a[h-1][l-1];
	return 0;
} 

借鉴了亿点P5731的代码,butCE了,怎么改…

2021/10/10 14:35
加载中...