ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1017. Лестницы

To all LAMERS!!!
Послано Yuriy Frolov (ufrolov@ukr.net) 2 янв 2003 04:23
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 {&#1031;&#1168;&#1072;&#1168;&#1038;&#174;&#1072; &#1031;&#174; 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 (-)
Послано Miguel Angel 3 янв 2003 07:19
> 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 {&#1031;&#1168;&#1072;&#1168;&#1038;&#174;&#1072; &#1031;&#174; 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!!!
Послано (Psyche) Daniel Pasaila 10 фев 2003 14:06
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!!!
Послано carol_m1 21 июн 2003 19:48
what does your program mean?
How long your program is!
Послано XmYjd 16 ноя 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!!!
Послано dibrov.bor 7 дек 2006 01:57
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
Послано Manohar prabhu 7 апр 2010 18:45
You turned out to be a lamer yourself.
go learn C or C++.
Re: How long your program is!
Послано Ahmed Ahmedov 17 мар 2011 12:55
This code is beautiful. Can you explain it please? Thanks
Re: How long your program is!
Послано Artem 14 янв 2012 22:40
Ahmed Ahmedov писал(a) 17 марта 2011 12:55
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!
Послано hac 27 фев 2012 22:16
try
 a[j]+=a[j-i];
Re: To all LAMERS!!!
Послано amirani 7 авг 2012 18:01
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 (-)
Послано staticor 23 июн 2013 21:13
so long , can't read.
Re: How long your program is!
Послано Marius Žilėnas 29 окт 2013 13:35
This works. How did you come to this short solution:)?
Re: How long your program is!
Послано Temak 27 окт 2015 04:49
Artem, good one! Красава) Доставил твой пост:)