谁帮我看一下错哪里
查看原帖
谁帮我看一下错哪里
1625580
qiankun888楼主2025/1/30 22:25
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n>26)
	{
		for(int i=1;i<=26;i++)
		{
			for(int j=i;j<=26;j++)
			{
				if(j>26)	cout<<char(j+64-26);
				else		cout<<char(j+64);
			}
			for(int j=i;j<=(n-26);j++)
			{
				if(j>26)	cout<<char(j+64-26);
				else		cout<<char(j+64);
			}
			cout<<endl;
		}
		for(int i=1;i<=(n-26);i++)
		{
			for(int j=i;j<=26;j++)
			{
				if(j>26)	cout<<char(j+64-26);
				else		cout<<char(j+64);
			}
			for(int j=1;j<=(n-26);j++)
			{
				if(j>26)	cout<<char(j+64-26);
				else		cout<<char(j+64);
			}
			cout<<endl;
		}
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=i;j<=n+i-1;j++)
			{
				if(j>26)	cout<<char(j+64-26);
				else		cout<<char(j+64);
			}
			cout<<endl;
		}
	}
	return 0;
}

谢谢了

2025/1/30 22:25
加载中...