ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1228. Array

Destiny My Solution Here: [8] // Problem 1228. Array 14 Nov 2002 07:19
program arrays;
var
 k:array[1..20]of longint;
 d:array[0..20]of longint;
 n:integer;
 s:longint;
procedure init;
var
 i:integer;
begin
 readln(n,s);
 for i:=1 to n do
  readln(d[i]);
 d[0]:=s;
end;
procedure solve;
var
 i:integer;
begin
 k[n]:=d[n-1]-1;
 for i:=n-1 downto 1 do
  k[i]:=(d[i-1] div d[i])-1;
 for i:=1 to n-1 do
  write(k[i],' ');
 writeln(k[n]);
end;
begin
 init;
 solve;
end.
Coldfeel mine???shorter [2] // Problem 1228. Array 21 Nov 2002 21:31
const maxn=20;
var w,n,i:longint;
    a,b:array [1..maxn] of longint;
begin
    readln(w,n);
    for i:=1 to w do readln(a[i]);
    n:=n-1;i:=1;
    repeat
    b[i]:=n div a[i];
    n:=n mod a[i];
    inc(i);
    until n=0;
    for i:=1 to w do write(b[i],' ');
end.
> const maxn=20;
> var w,n,i:longint;
>     a,b:array [1..maxn] of longint;
> begin
>     readln(w,n);
>     for i:=1 to w do readln(a[i]);
>     n:=n-1;i:=1;
>     repeat
>     b[i]:=n div a[i];
>     n:=n mod a[i];
>     inc(i);
>     until n=0;
>     for i:=1 to w do write(b[i],' ');
> end.
Kolyanich what about mine? // Problem 1228. Array 24 Dec 2002 13:41
#include <fstream.h>

void main()
{
    int n, s, t, i;
    cin >> n >> s;

    for(i=0; i<n; i++) {
        cin >> t; cout << (s / t) - 1 << " "; s = t;
    }
}
Oyh Shoter and shoter [1] // Problem 1228. Array 11 Mar 2009 10:42
var
  n,s,d:longint;
begin
  readln(n,s);
  dec(s);
  for n:=1 to n do
    begin
      readln(d);
      write(s div d,' ');
      s:=s mod d;
    end;
end.
Abbos Re: Shoter and shoter // Problem 1228. Array 31 Jul 2016 12:15
What is the use of showing you and your code off ?
Abbos Re: My Solution Here: // Problem 1228. Array 31 Jul 2016 12:17
Instead of getting proud of yourself, giving clarification is much more better
Abbos Re: My Solution Here: // Problem 1228. Array 31 Jul 2016 12:18
Instead of getting proud of yourself and giving right code, giving clarification is much more better