1 条题解
-
0
C++ :
# include <iostream> using namespace std; char a[30] = "0123456789ABCDEFGHIJKLMN"; int main(){ int n; cin >> n; for (int i = 1; i <= n; i ++){ for (int j = 1; j <= n - i; j ++){ cout << " "; } for (int j = 1; j <= i; j ++){ cout << a[j]; } for (int j = i - 1; j >= 1; j --){ cout << a[j]; } cout << endl; } return 0; }Pascal :
var n,i,j,b,x,m:integer; begin readln(n); for i:=1 to n do begin for j:=1 to i do begin if j>9 then x:=55+j else x:=48+j; b:=n-i+1; if j=1 then write(chr(x):b) else write(chr(x)); end; for m:=i-1 downto 1 do begin if m>9 then x:=55+m else x:=48+m; write(chr(x)); end; writeln; end; end.
- 1
信息
- ID
- 2034
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者