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 1796. Amusement Park

wrong answer #7.
Posted by Bahodir | IT of TUIT | 19 Feb 2015 02:51
Please give me test...My code :

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Park1796_ {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int a[] = new int[6];
        int max = 999999999, k = 0;
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
            if (a[i] != 0 && a[i] < max) {
                max = a[i];
                k = i;
            }
        }
        int b = in.nextInt();
        int sum = 0;
        sum += a[0] = 10 * a[0];
        sum += a[1] = 50 * a[1];
        sum += a[2] = 100 * a[2];
        sum += a[3] = 500 * a[3];
        sum += a[4] = 1000 * a[4];
        sum += a[5] = 5000 * a[5];
        switch (k){
            case 0: k = 10;   break;
            case 1: k = 50;   break;
            case 2: k = 100;  break;
            case 3: k = 500;  break;
            case 4: k = 1000; break;
            case 5: k = 5000; break;
        }
        int l = 0, d = sum - k;
        int count = 0, f = 0;
        f = d / b + 1;
        while (f * b <= sum && f * b >= d){
            out.print(f + " ");
            count++;
            f++;
        }
        System.out.println(count);
        out.flush();
    }
}

Edited by author 19.02.2015 03:01