
pascal空心的字母金字塔
Description输入一个大写的英文字母,输出一个空心的字母金字塔。Input只有一行且只有一个大写英文字母Output一个空心的大写英文字母金字塔。其中第一行的字母...
Description
输入一个大写的英文字母,输出一个空心的字母金字塔。
Input
只有一行且只有一个大写英文字母
Output
一个空心的大写英文字母金字塔。
其中第一行的字母“A”在第40列。
Sample Input
E
Sample Output
A
B B
C C
D D
EEEEEEEEE
Source
基础题 展开
输入一个大写的英文字母,输出一个空心的字母金字塔。
Input
只有一行且只有一个大写英文字母
Output
一个空心的大写英文字母金字塔。
其中第一行的字母“A”在第40列。
Sample Input
E
Sample Output
A
B B
C C
D D
EEEEEEEEE
Source
基础题 展开
1个回答
展开全部
var
ch,i:char;
kg,ck,j:integer;
begin
read(ch);ck:=40;kg:=-1;
for i:='A' to chr(ord(ch)-1) do
begin
write(i:ck);
dec(ck);
for j:=1 to kg do
write(' ');
inc(kg,2);
if i<>'A' then
write(i);
writeln;
end;
write(ch:ck);
for j:=2 to kg+2 do
write(ch);
end.
AC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ch,i:char;
kg,ck,j:integer;
begin
read(ch);ck:=40;kg:=-1;
for i:='A' to chr(ord(ch)-1) do
begin
write(i:ck);
dec(ck);
for j:=1 to kg do
write(' ');
inc(kg,2);
if i<>'A' then
write(i);
writeln;
end;
write(ch:ck);
for j:=2 to kg+2 do
write(ch);
end.
AC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
更多追问追答
追问
pascal高精度除法(一)呢?
Description
输入二个正整数m、n,输出m除以n的商k和余数r。
Input
第一行只有一个正整数:m ( 1 < m < 10^200 )
第二行只有一个正整数:n ( 1 < n <10^10 )
Output
第一行只有一个正整数:k
第二行只有一个正整数:r
Sample Input
123
5
Sample Output
24
3
Source
基础题 如果AC了,给你高分
追答
var
a:array[1..3000] of longint;
s:string;
i,j,len:longint;
t,r:int64;
begin
readln(s);
readln(t);
len:=length(s);
for i:=1 to len do
begin
r:=r*10+ord(s[i])-48;
a[i]:=r div t;
r:=r mod t;
end;
i:=1;
while (a[i]=0)and(i<len) do
inc(i);
for j:=i to len do
write(a[j]);
writeln;
writeln(r);
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询