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 for java
Posted by boyfox 24 Oct 2009 17:31
import java.util.Scanner;
public class T1228 {

        public static void main(String[] args)
        {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int k = in.nextInt();
            int[] a = new int[n+1];
            for (int i = 1; i <=n; i++)
            {
                a[i] = in.nextInt();
            }
            k -=1;
            int t=1;
            while (k!=0)
            {
                System.out.print((k/a[t])+" ");
                k = k%a[t];
                t++;
            }
        }
}