2010. 菱形

BillChen2000

原来“-代表空格”这句话是真的代表“ ”……

kcisemedamuoy

此题坑爹
这种题目真的有毒…非常感谢

Saitama

建议将hint以及tips加粗

10175102142

输出有毒

徐摆渡

我感觉此题坑点 不在空格 而是那个边长 边长究竟是菱形边长还是第一行‘*’前的空格数?

YZAZJL

include

include

using namespace std;

int main()
{
int n;
while(cin >> n){
int i;
int cnt_ttl = 1 + n * 2;
for(i = 0; i <= n; i++){
int cnt_main = 1 + i * 2;
int cnt_space = (cnt_ttl - cnt_main)/2;
int j;
for(j = 0; j < cnt_space; j++){
cout << ” “;
}
for(j = 0; j < cnt_main; j++){
cout << “”;
}
for(j = 0; j < cnt_space; j++){
cout << ” “;
}
cout << endl;
}
for(i = n - 1; i >= 0; i–){
int cnt_main = 1 + i * 2;
int cnt_space = (cnt_ttl - cnt_main)/2;
int j;
for(j = 0; j < cnt_space; j++){
cout << ” “;
}
for(j = 0; j < cnt_main; j++){
cout << “
”;
}
for(j = 0; j < cnt_space; j++){
cout << ” “;
}
cout << endl;
}
}
return 0;
}

Lento_Ye

这道题改过来了,不要用-代表空格了。。。

你当前正在回复 博客/题目
存在问题!