Submission #2433741


Source Code Expand

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    Boolean finded = false;
    out: for (int a = n; a >= 0; a--) {
      for (int b = n - a; b >= 0; b--) {
        int c = n - a - b;
        if (a * 10000 + b * 5000 + c * 1000 == y) {
          finded = true;
          System.out.println(String.format("%d %d %d", a, b, c));
          break out;
        }
      }
    }
    if (!finded) System.out.println("-1 -1 -1");
  }
}

Submission Info

Submission Time
Task C - Otoshidama
User amama
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 583 Byte
Status AC
Exec Time 104 ms
Memory 21972 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 94 ms 18772 KB
a02 AC 92 ms 21076 KB
a03 AC 101 ms 19920 KB
a04 AC 94 ms 19028 KB
b05 AC 92 ms 19924 KB
b06 AC 93 ms 21716 KB
b07 AC 93 ms 18772 KB
b08 AC 102 ms 21972 KB
b09 AC 92 ms 19668 KB
b10 AC 101 ms 21460 KB
b11 AC 100 ms 19924 KB
b12 AC 104 ms 21332 KB
b13 AC 102 ms 18900 KB
b14 AC 101 ms 20052 KB
b15 AC 93 ms 19668 KB
b16 AC 95 ms 20820 KB
b17 AC 94 ms 19156 KB
b18 AC 94 ms 19796 KB
b19 AC 92 ms 18768 KB
b20 AC 102 ms 19412 KB
b21 AC 102 ms 18900 KB
b22 AC 99 ms 19924 KB
b23 AC 101 ms 19028 KB
b24 AC 101 ms 21844 KB