To all LAMERS!!! const n=500; var a:array[1..n]of string; i,j,k,l,m,rk,v,t,z,pus:longint; sum,ss,zz:string; function mmm(p:longint):longint; begin v:=1; while ((v+1)*(v+2)) div 2<=p do v:=v+1; mmm:=v; end; function plus(pluss1,pluss2:string):string; {only pozitive!!!} var plusi,pluscode,plusi1,plusi2,plusna,plusba:integer; pluss,plusss:string; begin if pluss1='' then pluss1:='0'; if pluss2='' then pluss2:='0'; pluss:=''; while length(pluss1)<length(pluss2) do pluss1:='0'+pluss1; while length(pluss2)<length(pluss1) do pluss2:='0'+pluss2; plusna:=0; plusba:=0; for plusi:=length(pluss1) downto 1 do begin val(pluss1[plusi],plusi1,pluscode); val(pluss2[plusi],plusi2,pluscode); plusba:=(plusi1+plusi2+plusna) mod 10; plusna:=(plusi1+plusi2+plusna) div 10; str(plusba,plusss); pluss:=plusss+pluss; end; if plusna<>0 then begin str(plusna,plusss); pluss:=plusss+pluss; end; plus:=pluss; end; begin readln(m); for i:=1 to m do a[i]:='1'; sum:='0'; rk:=mmm(m); for i:=2 to rk do begin {ЇҐаҐЎ®а Ї® k} for j:=1 to i do begin t:=i+j; while (t<(i+1)*i div 2)and(t<=m) do t:=t+i; ss:='0'; while t<=m do begin zz:=a[t]; a[t]:=plus(a[t-i],ss); t:=t+i; ss:=zz; end; end; if m<((i+1)*i div 2)-1 then pus:=m else pus:=((i+1)*i div 2)-1; for z:=1 to pus do a[z]:='0'; sum:=plus(sum,a[m]); end; writeln(sum); end. There's an even easier way (-) > const n=500; > var a:array[1..n]of string; > i,j,k,l,m,rk,v,t,z,pus:longint; > sum,ss,zz:string; > function mmm(p:longint):longint; > begin > v:=1; > while ((v+1)*(v+2)) div 2<=p do v:=v+1; > mmm:=v; > end; > function plus(pluss1,pluss2:string):string; {only pozitive!!!} > var plusi,pluscode,plusi1,plusi2,plusna,plusba:integer; > pluss,plusss:string; > begin > if pluss1='' then pluss1:='0'; > if pluss2='' then pluss2:='0'; > pluss:=''; > while length(pluss1)<length(pluss2) do pluss1:='0'+pluss1; > while length(pluss2)<length(pluss1) do pluss2:='0'+pluss2; > plusna:=0; plusba:=0; > for plusi:=length(pluss1) downto 1 do begin > val(pluss1[plusi],plusi1,pluscode); > val(pluss2[plusi],plusi2,pluscode); > plusba:=(plusi1+plusi2+plusna) mod 10; > plusna:=(plusi1+plusi2+plusna) div 10; > str(plusba,plusss); > pluss:=plusss+pluss; > end; > if plusna<>0 then begin > str(plusna,plusss); > pluss:=plusss+pluss; > end; > plus:=pluss; > end; > begin > readln(m); > for i:=1 to m do a[i]:='1'; > sum:='0'; > rk:=mmm(m); > for i:=2 to rk do begin {ЇҐаҐЎ®а Ї® k} > for j:=1 to i do begin > t:=i+j; > while (t<(i+1)*i div 2)and(t<=m) do t:=t+i; > ss:='0'; > while t<=m do begin > zz:=a[t]; > a[t]:=plus(a[t-i],ss); > t:=t+i; > ss:=zz; > end; > end; > if m<((i+1)*i div 2)-1 then pus:=m else pus:=((i+1)*i div 2)- 1; > for z:=1 to pus do a[z]:='0'; > sum:=plus(sum,a[m]); > end; > writeln(sum); > end. Re: To all LAMERS!!! your solution is verry stupid. I think only one lamer could solve the problem like this. I wrote only 22 lines. Of course, Pascal suks. Re: To all LAMERS!!! what does your program mean? How long your program is! Posted by XmYjd 16 Nov 2006 13:37 program ural1017; var q:array[0..500]of int64; n,i,j:integer; begin fillchar(q,sizeof(q),0); readln(n); q[0]:=1; for i:=1 to n do for j:=n downto i do inc(q[j],q[j-i]); writeln(q[n]-1); end. Re: To all LAMERS!!! haha, why anyone use array with length 500? just try to think a little, program need array with length no more 32! This solution is plain stupid You turned out to be a lamer yourself. go learn C or C++. Re: How long your program is! This code is beautiful. Can you explain it please? Thanks Re: How long your program is! Posted by Artem 14 Jan 2012 22:40 This code is beautiful. Can you explain it please? Thanks This code is sux. I wrote it with C++. It answers 0 with any input =\ And, yes, I wrote it right. #include <iostream> using namespace std; int main(void) { short n; cin >> n; long long a[501]; for (short i=0; i<501; i++) a[i]=0; a[0]=1; for (short i=1; i<=n; i++) for (short j=n; j>=i; j--) a[j]+=a[j-1]; cout << a[n]-1; return 0; } It writes 0 with any input cuz we n times doing operation a[j]=a[j-1] for j from n to i. Of course the 1 we placed in the beginning goes to the a[n]. Then we are outputting a[n]-1, witch of course will be 1-1=0. The only good in this code that I saw was that this code can generate Pascal's triangle. Re: How long your program is! Posted by hac 27 Feb 2012 22:16 try a[j]+=a[j-i]; Re: To all LAMERS!!! LOL! the only lamer here is "Yuriy Frolov (ufrolov@ukr.net)"-:D :D :D Your program is worst i've ever seen :D :D :D You chose stupidest way to solve and you think that others are lamers??? :D it would be better to hide this solution except to submit it :D Re: There's an even easier way (-) so long , can't read. Re: How long your program is! This works. How did you come to this short solution:)? Re: How long your program is! Posted by Temak 27 Oct 2015 04:49 Artem, good one! Красава) Доставил твой пост:) |