Created
November 11, 2017 12:42
-
-
Save techlarry/57cd9d85bcfe24c0d621a9e28a538772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
char a; | |
cin >> a; | |
for(int i =1; i<=3;i++){ | |
for (int j=1; j<4-i;j++) | |
cout << " "; | |
for (int j=1; j<=2*i-1; j++) | |
cout << a; | |
cout << '\n'; | |
} | |
for(int i =2; i>=1;i--){ | |
for (int j=1; j<4-i;j++) | |
cout << " "; | |
for (int j=1; j<=2*i-1; j++) | |
cout << a; | |
cout << '\n'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2:字符菱形 | |
总时间限制: 1000ms 内存限制: 65536kB | |
描述 | |
给定一个字符,用它构造一个对角线长5个字符,倾斜放置的菱形。 | |
输入 | |
输入只有一行, 包含一个字符。 | |
输出 | |
该字符构成的菱形。 | |
样例输入 | |
* | |
样例输出 | |
* | |
*** | |
***** | |
*** | |
* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment