1樓:匿名使用者
第一題program isbn(input,output);
vars:string;
k:longint;
begin
assign(input,'isbn.in');reset(input);
assign(output,'isbn.out');rewrite(output);
readln(s);
k:=(ord(s[1])-48)*1+(ord(s[3])-48)*2+(ord(s[4])-48)*3+(ord(s[5])-48)*4+(ord(s[7])-48)*5+(ord(s[8])-48)*6+(ord(s[9])-48)*7+(ord(s[10])-48)*8+(ord(s[11])-48)*9;
if (k mod 11=ord(s[13])-48)or(k mod 11=10)and(s[13]='x') then writeln('right')
else
begin
if k mod 11=10 then writeln(copy(s,1,12),'x')
else writeln(copy(s,1,12),k mod 11);
end;
close(input);
close(output);
end.
第二題:
program seat(input,output);
vara,b,c,d:array[1..10000] of longint;
m,n,k,l,z,i,j,x,y,x1,y1:longint;
procedure kp1(h,t:longint);
vari,j,x,y:longint;
begin
x:=a[h];
y:=c[h];
i:=h;
j:=t;
while ix) do inc(i);
if ih then kp1(h,i-1);
if i+1x) do inc(i);
if ih then kp2(h,i-1);
if i+1x) do dec(j);
if ih then kp3(h,i-1);
if i+1x) do dec(j);
if ih then kp4(h,i-1);
if i+1=k then
begin
x:=(k-1)*3+(i-1)*2+1;
y:=(j-1)*4+1+(i-1)*2;
a[x,y]:='+';
a[x+1,y]:='|';
a[x+2,y]:='|';
a[x+3,y]:='+';
a[x,y+1]:='-';
a[x+1,y+1]:=' ';
a[x+2,y+1]:=' ';
a[x+3,y+1]:='-';
a[x+4,y+1]:='/';
a[x,y+2]:='-';
a[x+1,y+2]:=' ';
a[x+2,y+2]:=' ';
a[x+3,y+2]:='-';
a[x+4,y+2]:=' ';
a[x+5,y+2]:='+';
a[x,y+3]:='-';
a[x+1,y+3]:=' ';
a[x+2,y+3]:=' ';
a[x+3,y+3]:='-';
a[x+4,y+3]:=' ';
a[x+5,y+3]:='-';
a[x,y+4]:='+';
a[x+1,y+4]:='|';
a[x+2,y+4]:='|';
a[x+3,y+4]:='+';
a[x+4,y+4]:=' ';
a[x+5,y+4]:='-';
a[x+1,y+5]:='/';
a[x+2,y+5]:=' ';
a[x+3,y+5]:=' ';
a[x+4,y+5]:='/';
a[x+5,y+5]:='-';
a[x+2,y+6]:='+';
a[x+3,y+6]:='|';
a[x+4,y+6]:='|';
a[x+5,y+6]:='+';
if x+5>maxc then maxc:=x+5;
if y+6>maxk then maxk:=y+6;
end;
for i:=maxc downto 1 do
begin
for j:=1 to maxk do
write(a[i,j]);
writeln;
end;
close(input);
close(output);
end.
自己編的,不是官方程式
2樓:巴黎的祭司
樓上的第二題快排寫的太長了,第三題沒必要預處理
第一題program gy;
const
name='isbn';
vara,b:string;
procedure inp;
begin
assign(input,name+'.in');reset(input);
assign(output,name+'.out');rewrite(output);
readln(a);
end;
procedure main;
var i,j,k:longint;
begin
j:=0;k:=0;
for i:=1 to length(a)-1 do
if a[i]in['0'..'9']then
begin
inc(k);
j:=j+(ord(a[i])-ord('0'))*k;
end;
j:=j mod 11;
b:=a;
if j=10 then b[length(b)]:='x'else b[length(b)]:=chr(j+ord('0'));
end;
procedure oup;
begin
if b=a then writeln('right')
else writeln(b);
close(input);
close(output);
end;
begin
inp;
main;
oup;
end.
第二題program gy;
uses math;
const
name='seat';
varx1,y1,x2,y2:array[1..3000]of longint;
n,m,k,l,d:longint;
a,c:array[1..2,1..2000]of longint;
b1,b2:array[1..2000]of byte;
procedure inp;
var i:longint;
begin
assign(input,name+'.in');reset(input);
assign(output,name+'.out');rewrite(output);
randomize;
readln(m,n,k,l,d);
for i:=1 to d do readln(x1[i],y1[i],x2[i],y2[i]);
end;
procedure sort(p,l,r:longint);
var i,j,x,y:longint;
begin
i:=l;j:=r;x:=a[p,random(r-l)+l];
repeat
while a[p,i]>x do inc(i);
while a[p,j]j;
if lk then write(' ');
end;
writeln;
j:=0;
for i:=1 to n-1 do
if b2[i]=1 then
begin
inc(j);
write(i);
if j<>l then write(' ');
end;
writeln;
close(input);
close(output);
end;
begin
inp;
main;
oup;
end.
第三題program gy;
uses math;
const
name='ball';
varf:array[0..1,1..500]of longint;
m,n:longint;
procedure inp;
begin
assign(input,name+'.in');reset(input);
assign(output,name+'.out');rewrite(output);
readln(n,m);
end;
procedure main;
var i,j:longint;
begin
f[0,1]:=1;
for i:=1 to m do
for j:=1 to n do
f[i mod 2,j]:=f[(i-1)mod 2,(j+n-2)mod n+1]+f[(i-1)mod 2,(j+n)mod n+1];
end;
procedure oup;
begin
writeln(f[m mod 2,1]);
close(input);
close(output);
end;
begin
inp;
main;
oup;
end.
第四題program gy;
const
work='drawing';
type
rec=record
x,y:longint;
end;
arr=array[1..20000] of longint;
vara:array[1..300,1..300] of longint;
n,m,maxn,maxm:longint;
b:array[1..1000,1..1000]of char;
procedure inp;
var i,j:longint;
begin
assign(input,work+'.in');reset(input);
assign(output,work+'.out');rewrite(output);
read(n,m);
for i:=1 to n do
for j:=1 to m do
read(a[n+1-i,j]);
maxn:=0;maxm:=0;
for i:=1 to n do
for j:=1 to m do
begin
if 2*i+4*j+1>maxm then maxm:=2*i+4*j+1;
if (2*i+3*a[i,j]+1>maxn) then maxn:=2*i+3*a[i,j]+1;
end;
for i:=1 to maxn do
for j:=1 to maxm do
b[i,j]:='.';
end;
procedure main;
var i,j,k,x,y:longint;
begin
for i:=n downto 1 do
for j:=1 to m do
for k:=1 to a[i,j] do
begin
y:=2*i+4*j-5;x:=2*i+3*k-4;
b[x,y]:='+';
b[x,y+1]:='-';
b[x,y+2]:='-';
b[x,y+3]:='-';
b[x,y+4]:='+';
b[x+1,y]:='|';
b[x+1,y+1]:=' ';
b[x+1,y+2]:=' ';
b[x+1,y+3]:=' ';
b[x+1,y+4]:='|';
b[x+1,y+5]:='/';
b[x+2,y]:='|';
b[x+2,y+1]:=' ';
b[x+2,y+2]:=' ';
b[x+2,y+3]:=' ';
b[x+2,y+4]:='|';
b[x+2,y+5]:=' ';
b[x+2,y+6]:='+';
b[x+3,y]:='+';
b[x+3,y+1]:='-';
b[x+3,y+2]:='-';
b[x+3,y+3]:='-';
b[x+3,y+4]:='+';
b[x+3,y+5]:=' ';
b[x+3,y+6]:='|';
b[x+4,y+1]:='/';
b[x+4,y+2]:=' ';
b[x+4,y+3]:=' ';
b[x+4,y+4]:=' ';
b[x+4,y+5]:='/';
b[x+4,y+6]:='|';
b[x+5,y+2]:='+';
b[x+5,y+3]:='-';
b[x+5,y+4]:='-';
b[x+5,y+5]:='-';
b[x+5,y+6]:='+';
end;
end;
procedure oup;
var i,j:longint;
begin
for i:=maxn downto 1 do
begin
for j:=1 to maxm do
write(b[i,j]);
writeln;
end;
close(input);
close(output);
end;
begin
inp;
main;
oup;
end.
測過全對(逐字節)
怎麼讓男人不長鬍子的地方長鬍子?求普及
多剃毛,剔著剔著日子久了,毛髮就粗了,黑了,還有一點,很多那種絡腮鬍子的man男那是家族遺傳的,很多國外的有絡腮鬍子,混血的一般遺傳國外的,比如高以翔 沒長鬍子的地方可通過鬍鬚移植長出鬍子,簡單說來,就與植髮的方法是一樣噠。鬍鬚移植將健康的毛囊移植到鬍子缺乏的區域中,有點拆東牆被西牆的意思。而健康的...
智慧型手機是什麼時候?開始普及的,我到2023年才用上第一部智慧型手機,是不是像個鄉巴佬一樣
2009年開始有智慧型手機,以後逐漸普及。我當年用的是三星s5用了三年半,之前是非智慧型的諾基亞x2用了四年,所以說你並不丟人的,時間我推推啊,s5是2014.6買的往前4年是2010年,我記得那時候是蘋果3比較流行的時候 我沒買 以前cctv6放過的一部電影,講一男一女認識了不久就結婚了以後的事情...
求資源 windows server 2019安裝系統
建議去csdn看看,那裡的微軟系統比較全,而且是官方正版。windows server 2003 r2,enterprise edition with sp2 disc 1 vl windows server 2003 r2,enterprise edition with sp2 disc 2 vl...