1 solutions
-
0
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { char a = '*'; int n; cin >> n; for(int i = 1 ;i <= 2*n-1 ;i++){ if(i == 1 || i == 2*n-1){ for(int j = 1 ;j <= 3*n-2 ;j++){ if(j < n || j >= 2*n){ cout << " "; }else{ cout << a; } } }else if(i <= n){ for(int j = 1 ;j <= 3*n-2 ;j++){ if(j == n-i+1 ||j == 2*n+i-2){ cout << a; }else{ cout << " "; } } }else if(i > n){ for(int j = 1 ;j <= 3*n-2 ;j++){ if(j == i-n+1 ||j == 4*n-2-i){ cout << a; }else{ cout << " "; } } } cout << endl; } return 0; }
- 1
Information
- ID
- 343
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- 4
- Tags
- # Submissions
- 87
- Accepted
- 41
- Uploaded By