132 条题解
-
0zjhaohao1993 LV 6 @ 2009-07-16 14:19:22
program hanoi;
var
a,b:array[0..100] of integer;
i,j,n:integer;
begin
read(n);
b[100]:=1;
for i:=1 to n do begin
for j:=1 to 100 do b[j]:=b[j]*2;
for j:=100 downto 1 do if b[j]>9 then begin
b[j]:=b[j]-10;
b[j-1]:=b[j-1]+1;
end;
for j:=1 to 100 do a[j]:=a[j]+b[j];
for j:=100 downto 1 do if a[j]>9 then begin
a[j]:=a[j]-10;
a[j-1]:=a[j-1]+1;
end;
end;
j:=1;
while a[j]=0 do j:=j+1;
for i:=j to 100 do write(a[i]);
end. -
02009-07-15 16:44:33@
program das;
var n,i,j:integer;
a:array[1..100] of 0..9;
procedure ppp(k:integer);
var i,j,w,s:integer;
begin
a[1]:=1;
w:=0;
for i:=1 to k do
for j:=1 to 100 do
begin
s:=a[j]*2+w;
a[j]:=s mod 10;
w:=s div 10;
end;
end;
begin
readln(n);
ppp(n+1);
if a[1]>=2 then a[1]:=a[1]-2
else
begin
a[1]:=a[1]+8;
a[2]:=a[2]-1;
end;
i:=100;
while a[i]=0 do i:=i-1;
for j:=i downto 1 do write(a[j]);
end. -
02009-07-14 23:04:03@
如此之水,真是好水,水到极致,不能再水……
-
02009-07-13 16:47:59@
高精度和数学公式
-
02009-07-09 18:16:54@
program cyfooo;
var
t:array[1..1000] of integer;
i,j,k,w:integer;
begin
read(i);i:=i+1;t[1]:=1;w:=0;
for j:=1 to i do
begin
for k:=1 to 1000 do
begin
t[k]:=t[k]*2;
end;
for k:=1 to 1000 do
begin
if t[k]>=10 then begin
t[k+1]:=t[k+1]+t[k] div 10;t[k]:=t[k] mod 10;
end;
end;
end;
t[1]:=t[1]-2;
for k:=1 to 1000 do
if t[k] -
02009-06-29 11:01:06@
数学题,答案=2(2^n-1)
-
02009-06-03 13:24:56@
(2^N-1)*2
水题。
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 -
02009-04-30 15:38:21@
测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
刷啊 -
02009-04-07 15:45:07@
program cyfooo;
var
t:array[1..1000] of integer;
i,j,k,w:integer;
begin
read(i);i:=i+1;t[1]:=1;w:=0;
for j:=1 to i do
begin
for k:=1 to 1000 do
begin
t[k]:=t[k]*2;
end;
for k:=1 to 1000 do
begin
if t[k]>=10 then begin
t[k+1]:=t[k+1]+t[k] div 10;t[k]:=t[k] mod 10;
end;
end;
end;
t[1]:=t[1]-2;
for k:=1 to 1000 do
if t[k] -
02009-04-06 18:08:50@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msprogram sasd;
var n,i,j,x,s:integer;
a:array[1..100] of integer;
begin
readln(n);
a[1]:=1;x:=1;
for i:=1 to n+1 do
begin
for j:=1 to x do
a[j]:=a[j]*2;
s:=x;
for j:=1 to s do
if a[j]>=10 then
begin
a[j+1]:=a[j+1]+a[j] div 10;
a[j]:=a[j] mod 10;
if j+1>x then x:=j+1;
end;
end;
a[1]:=a[1]-2;
for j:=x downto 1 do
write(a[j]);
end. -
02009-03-31 17:47:23@
program p1354;
var
n,i,j,k,l,t:integer;
cc:array[1..10000] of integer;procedure cheng(k:integer);
var i,j,q:integer;
begin
j:=0;
for i:=10000 downto l do
begin
cc[i]:=cc[i]*k;
q:=cc[i]+j;
cc[i]:=(cc[i]+j) mod 10;
j:=q div 10;end;
while j>0 do
begin
dec(l);
cc[l]:=j mod 10;
j:=j div 10;
end;
end;begin
readln(n);
l:=10000;
cc[10000]:=1;
for i:=1 to n+1 do
cheng(2);
cc[10000]:=cc[10000]-2;
for i:=l to 10000 do
write(cc[i]);
end.water.....
-
02009-03-22 10:42:08@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms水题。。
var
n,i:0..201;
s:string;
procedure cheng(var a:string);
var
ss:string;
l,j,m:integer;
b:array[0..300]of 0..20;
begin
m:=0;
l:=length(s);
for j:=1 to l do val(a[j],b[j]);
s:='';
for j:=l downto 1 do
begin
b[j]:=b[j]*2+m;
if b[j]>9 then begin m:=1; b[j]:=b[j] mod 10 end
else m:=0;
str(b[j],ss);
a:=ss+a
end;
if m=1 then a:='1'+a
end;
begin
readln(n);
if n -
02009-02-28 20:54:35@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
(通项公式2^(n+1)-2)+高精度=一次AC
附:
我的题解 - My Solution
#include "stdio.h"
int main()
{
int n,i,s[300]={0},j,d,t;
s[0]=1;
scanf("%d",&n);
t=1;
for(i=1;i=0;i--)
printf("%d",s[i]);
return 0;
} -
02009-02-03 22:11:51@
2^(n+1)-2
-
02009-02-02 11:14:37@
const
f:array[1..200]of ansistring=(
'2',
'6',
'14',
'30',
'62',
'126',
'254',
'510',
'1022',
'2046',
'4094',
'8190',
'16382',
'32766',
'65534',
'131070',
'262142',
'524286',
'1048574',
'2097150',
'4194302',
'8388606',
'16777214',
'33554430',
'67108862',
'134217726',
'268435454',
'536870910',
'1073741822',
'2147483646',
'4294967294',
'8589934590',
'17179869182',
'34359738366',
'68719476734',
'137438953470',
'274877906942',
'549755813886',
'1099511627774',
'2199023255550',
'4398046511102',
'8796093022206',
'17592186044414',
'35184372088830',
'70368744177662',
'140737488355326',
'281474976710654',
'562949953421310',
'1125899906842622',
'2251799813685246',
'4503599627370494',
'9007199254740990',
'18014398509481982',
'36028797018963966',
'72057594037927934',
'144115188075855870',
'288230376151711742',
'576460752303423486',
'1152921504606846974',
'2305843009213693950',
'4611686018427387902',
'9223372036854775806',
'18446744073709551614',
'36893488147419103230',
'73786976294838206462',
'147573952589676412926',
'295147905179352825854',
'590295810358705651710',
'1180591620717411303422',
'2361183241434822606846',
'4722366482869645213694',
'9444732965739290427390',
'18889465931478580854782',
'37778931862957161709566',
'75557863725914323419134',
'151115727451828646838270',
'302231454903657293676542',
'604462909807314587353086',
'1208925819614629174706174',
'2417851639229258349412350',
'4835703278458516698824702',
'9671406556917033397649406',
'19342813113834066795298814',
'38685626227668133590597630',
'77371252455336267181195262',
'154742504910672534362390526',
'309485009821345068724781054',
'618970019642690137449562110',
'1237940039285380274899124222',
'2475880078570760549798248446',
'4951760157141521099596496894',
'9903520314283042199192993790',
'19807040628566084398385987582',
'39614081257132168796771975166',
'79228162514264337593543950334',
'158456325028528675187087900670',
'316912650057057350374175801342',
'633825300114114700748351602686',
'1267650600228229401496703205374',
'2535301200456458802993406410750',
'5070602400912917605986812821502',
'10141204801825835211973625643006',
'20282409603651670423947251286014',
'40564819207303340847894502572030',
'81129638414606681695789005144062',
'162259276829213363391578010288126',
'324518553658426726783156020576254',
'649037107316853453566312041152510',
'1298074214633706907132624082305022',
'2596148429267413814265248164610046',
'5192296858534827628530496329220094',
'10384593717069655257060992658440190',
'20769187434139310514121985316880382',
'41538374868278621028243970633760766',
'83076749736557242056487941267521534',
'166153499473114484112975882535043070',
'332306998946228968225951765070086142',
'664613997892457936451903530140172286',
'1329227995784915872903807060280344574',
'2658455991569831745807614120560689150',
'5316911983139663491615228241121378302',
'10633823966279326983230456482242756606',
'21267647932558653966460912964485513214',
'42535295865117307932921825928971026430',
'85070591730234615865843651857942052862',
'170141183460469231731687303715884105726',
'340282366920938463463374607431768211454',
'680564733841876926926749214863536422910',
'1361129467683753853853498429727072845822',
'2722258935367507707706996859454145691646',
'5444517870735015415413993718908291383294',
'10889035741470030830827987437816582766590',
'21778071482940061661655974875633165533182',
'43556142965880123323311949751266331066366',
'87112285931760246646623899502532662132734',
'174224571863520493293247799005065324265470',
'348449143727040986586495598010130648530942',
'696898287454081973172991196020261297061886',
'1393796574908163946345982392040522594123774',
'2787593149816327892691964784081045188247550',
'5575186299632655785383929568162090376495102',
'11150372599265311570767859136324180752990206',
'22300745198530623141535718272648361505980414',
'44601490397061246283071436545296723011960830',
'89202980794122492566142873090593446023921662',
'178405961588244985132285746181186892047843326',
'356811923176489970264571492362373784095686654',
'713623846352979940529142984724747568191373310',
'1427247692705959881058285969449495136382746622',
'2854495385411919762116571938898990272765493246',
'5708990770823839524233143877797980545530986494',
'11417981541647679048466287755595961091061972990',
'22835963083295358096932575511191922182123945982',
'45671926166590716193865151022383844364247891966',
'91343852333181432387730302044767688728495783934',
'182687704666362864775460604089535377456991567870',
'365375409332725729550921208179070754913983135742',
'730750818665451459101842416358141509827966271486',
'1461501637330902918203684832716283019655932542974',
'2923003274661805836407369665432566039311865085950',
'5846006549323611672814739330865132078623730171902',
'11692013098647223345629478661730264157247460343806',
'23384026197294446691258957323460528314494920687614',
'46768052394588893382517914646921056628989841375230',
'93536104789177786765035829293842113257979682750462',
'187072209578355573530071658587684226515959365500926',
'374144419156711147060143317175368453031918731001854',
'748288838313422294120286634350736906063837462003710',
'1496577676626844588240573268701473812127674924007422',
'2993155353253689176481146537402947624255349848014846',
'5986310706507378352962293074805895248510699696029694',
'11972621413014756705924586149611790497021399392059390',
'23945242826029513411849172299223580994042798784118782',
'47890485652059026823698344598447161988085597568237566',
'95780971304118053647396689196894323976171195136475134',
'191561942608236107294793378393788647952342390272950270',
'383123885216472214589586756787577295904684780545900542',
'766247770432944429179173513575154591809369561091801086',
'1532495540865888858358347027150309183618739122183602174',
'3064991081731777716716694054300618367237478244367204350',
'6129982163463555433433388108601236734474956488734408702',
'12259964326927110866866776217202473468949912977468817406',
'24519928653854221733733552434404946937899825954937634814',
'49039857307708443467467104868809893875799651909875269630',
'98079714615416886934934209737619787751599303819750539262',
'196159429230833773869868419475239575503198607639501078526',
'392318858461667547739736838950479151006397215279002157054',
'784637716923335095479473677900958302012794430558004314110',
'1569275433846670190958947355801916604025588861116008628222',
'3138550867693340381917894711603833208051177722232017256446',
'6277101735386680763835789423207666416102355444464034512894',
'12554203470773361527671578846415332832204710888928069025790',
'25108406941546723055343157692830665664409421777856138051582',
'50216813883093446110686315385661331328818843555712276103166',
'100433627766186892221372630771322662657637687111424552206334',
'200867255532373784442745261542645325315275374222849104412670',
'401734511064747568885490523085290650630550748445698208825342',
'803469022129495137770981046170581301261101496891396417650686',
'1606938044258990275541962092341162602522202993782792835301374',
'3213876088517980551083924184682325205044405987565585670602750');var
m:longint;begin
readln(m);
write(f[m]);
end.小打一表!!!!
-
02009-01-22 18:30:57@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msif(P1354==纠结的水题) coutn;}
void fuck()
{int i,t,j,k,l,a[200]={0},x,bj=0;;
a[1]=2;t=1;
for(i=2;it){t++;a[j]=x;}
a[1]+=2;
while(a[l]>=10){a[l]%=10;a[l+1]+=1;l++;}
}while(a[t]==0)t--;
for(i=t;i>=1;i--)
cout -
02009-01-02 20:31:36@
水题
var
n,i,j:longint;
a:array[0..1000] of integer;
begin
readln(n);
a[1]:=2;
a[0]:=1;
for i:=2 to n do
begin
for j:=1 to a[0] do
a[j]:=a[j]*2;
a[1]:=a[1]+2;
for j:=1 to a[0] do
begin
a[j+1]:=a[j+1]+a[j] div 10;
a[j]:=a[j] mod 10;
end;
while a[a[0]+1]0 do
inc(a[0]);
end;
for i:=a[0] downto 1 do
write(a[i]);
end. -
02009-03-15 16:46:03@
#include
int n;void init()
{scanf("%d",&n);}void work()
{int i,t,j,k,l,a[200]={0},x,bj=0;;
a[1]=2;t=1;
for(i=2;it){t++;a[j]=x;}
a[1]+=2;
while(a[l]>=10){a[l]%=10;a[l+1]+=1;l++;}
}while(a[t]==0)t--;
for(i=t;i>=1;i--)
printf("%d",a[i]);
}main()
{init();
work();
return 0;}
-
02008-12-08 13:37:53@
program hanoi(input,output);
const
maxlen=100;
type
hp=record
len:integer;
s:array[1..maxlen] of integer;
end;
var
n,i:integer;
x:array[1..2] of hp;
y:hp;
ans,ch:string;
a,code:integer;
function outit(const p:hp):string;
var
i:integer;
ch:string;
begin
outit:='';
for i:=p.len downto 1 do
begin
str(p.s[i],ch);
outit:=outit+ch;
end;
end;
procedure init(a,b:string);
var
j,i:integer;
begin
j:=1;
x[j].len:=length(a);
for i:=1 to x[j].len do
x[j].s[i]:=ord(a[x[j].len+1-i])-ord('0');
j:=2;
x[j].len:=length(b);
for i:=1 to x[j].len do
x[j].s[i]:=ord(b[x[j].len+1-i])-ord('0');
end;
procedure Plus(a,b:hp;var c:hp);
var i,len:integer;
begin
fillchar(c,sizeof(c),0);
if a.len>b.len
then len:=a.len
else len:=b.len;
for i:=1 to len do
begin
inc(c.s[i],a.s[i]+b.s[i]);
if c.s[i]>=10 then
begin
dec(c.s[i],10);
inc(c.s);
end;
end;
if c.s[len+1]>0 then inc(len);
c.len:=len;
end;
function main(a,b:string):string;
begin
init(a,b);
Plus(x[1],x[2],y);
main:=outit(y);
end;
begin
readln(n);
ans:='1';
for i:=1 to n do
ans:=main(ans,ans);
ch:=ans[length(ans)];
val(ch,a,code);
a:=a-1;
str(a,ch);
ans[length(ans)]:=ch[1];
writeln(main(ans,ans));
end. -
02008-11-20 13:54:43@
通项公式:2的n+1次方再减去2