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

My Solution Here:
Posted by Destiny 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.
mine???shorter
Posted by Coldfeel 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.
there are something i feel wrong but hard to say though i got AC
Posted by Coldfeel 21 Nov 2002 21:33
my program is wrong.but i don't know why it got AC...???
Posted by Coldfeel 21 Nov 2002 21:50
> 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.
what about mine?
Posted by Kolyanich 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;
    }
}
Shoter and shoter
Posted by Oyh 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.
Re: Shoter and shoter
Posted by Abbos 31 Jul 2016 12:15
What is the use of showing you and your code off ?
Re: My Solution Here:
Posted by Abbos 31 Jul 2016 12:17
Instead of getting proud of yourself, giving clarification is much more better
Re: My Solution Here:
Posted by Abbos 31 Jul 2016 12:18
Instead of getting proud of yourself and giving right code, giving clarification is much more better