求助92分!
查看原帖
求助92分!
524966
ImNot6Dora楼主2023/5/27 14:46
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	if(k>n/2.0*n){
		cout<<"NO\n";
		return 0;
	}
	cout<<"YES\n";
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(k==0){
				cout<<'S';
				continue;
			}
			if(i%2==1){
				if(j%2==1){
					cout<<'L';
					k--; 
				}else cout<<'S';
			}else{
				if(j%2==1)cout<<'S';
				else{
					cout<<'L';
					k--;
				}
			}
		}
		cout<<endl;
	}
	return 0;
}

2023/5/27 14:46
加载中...