- 分享
- 2009-10-17 17:50:43 @
1.32.58503.4874.0. (384615)
第一题不想敲了,第二题盖了。。
第三题:
const y=2009; maxn=50;
var n,i,j,s:longint; c:array[0..maxn,0..maxn] of longint;
begin s:=0; read(n); c[0,0]:=1; for i:=1 to n do begin c:=1; for j:=1 to i-1 do c:=c+c; c:=1; end; for i:=0 to n do s:=(s+c[n,i]) mod y; write(s);end.
第四题:
var n,m,i,j,k,p:integer; a,b:array[0..100]of integer;begin read(n,m); a[0]:=n; i:=0; p:=0; k:=0; repeat for j:=0 to i-1 do if a[i]=a[j] then begin p:=1; k:=j; break; end; if p0 then break; b[i]:= a[i] div m; a:=(a[i] mod m) * 10; inc(i); until a[i]=0; write(b[0],'.'); for j:=1 to k-1 do write(b[j]); if p0 then write('('); for j:=k to i-1 do write(b[j]); if p0 then write(')'); writeln;end.
3 条评论
-
hwze66 LV 8 @ 2009-10-17 17:50:43
赞楼上,我也是这样。
-
2009-10-17 17:48:26@
第一题最大公约数
第二题没看出来。自己模拟的
第三题是杨辉三角
第四题在VJ里有。。是算小数的循环节的 -
2009-10-17 17:37:34@
CHROME...
T3const
y=2009;
maxn=50;var
n,i,j,s:longint;
c:array[0..maxn,0..maxn] of longint;begin
s:=0;
read(n);
c[0,0]:=1;
for i:=1 to n do
begin
c:=1;
for j:=1 to i-1 do
c:=c+c;
c:=1;
end;
for i:=0 to n do
s:=(s+c[n,i]) mod y;
write(s);
end.T4
var
n,m,i,j,k,p:integer;
a,b:array[0..100]of integer;
begin
read(n,m);
a[0]:=n;
i:=0;
p:=0;
k:=0;
repeat
for j:=0 to i-1 do
if a[i]=a[j] then
begin
p:=1;
k:=j;
break;
end;
if p0 then break;
b[i]:= a[i] div m;
a:=(a[i] mod m) * 10;
inc(i);
until a[i]=0;
write(b[0],'.');
for j:=1 to k-1 do
write(b[j]);
if p0 then
write('(');
for j:=k to i-1 do
write(b[j]);
if p0 then
write(')');
writeln;
end.
- 1