我究竟错在何处 ~样例对了~WA一片
  • 板块B2083 画矩形
  • 楼主Cliuziyi
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/9/21 21:22
  • 上次更新2023/11/2 18:49:30
查看原帖
我究竟错在何处 ~样例对了~WA一片
771906
Cliuziyi楼主2023/9/21 21:22

代码

#include<bits/stdc++.h>
using namespace std;
void f(int b,char x,int c) {
	if(c==0) {
		cout<<x;
		for(int i=2; i<b; i++)cout<<" ";
		cout<<x<<endl;
		return;
	}
	for(int i=1; i<=b; i++) {
		cout<<x;
	}
	cout<<endl;
	return;
}
int main() {
	int a,b;
	cin>>b>>a;
	int c;
	char x;
	cin>>x>>c;
	for(int i=1; i<a; i++) {
		if(i==1) {
			for(int i=1; i<=b; i++) {
				cout<<x;
			}
			cout<<endl;
			continue;
		}
		f(b,x,c);
	}
	for(int i=1; i<=b; i++) {
		cout<<x;
	}
	return 0;
}

样例——————对了。 自创样例(10 10 $ 1)——————对了。。。 一提交 [https://www.luogu.com.cn/record/125481461]()

仰天长啸————————————啊!!!

我究竟错在何处?

望请大佬帮忙

谢谢~~~

2023/9/21 21:22
加载中...