Submission #2529775


Source Code Expand

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */




import java.util.* ;

/**
 *
 * @author nai
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int man, gosen, sen;
        boolean isAns = false;
        
        LOOP1 : for(int mi = 0 ; mi <= N ; mi++){
            for(int gi = 0 ; gi <= N - mi ; gi++){
                int si =   ( Y - mi * 10000 - gi * 5000 ) / 1000; 
                if(si == N - mi - gi){
                    isAns =true;
                    System.out.print(mi+" "+gi+" "+si);
                    break LOOP1;
                }
            }
        }
        if(!isAns){
            System.out.println("-1 -1 -1");
        }
    }
}
  
    

Submission Info

Submission Time
Task C - Otoshidama
User baito
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 1107 Byte
Status AC
Exec Time 107 ms
Memory 23380 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 93 ms 20684 KB
a02 AC 94 ms 19156 KB
a03 AC 91 ms 19796 KB
a04 AC 101 ms 21716 KB
b05 AC 92 ms 21716 KB
b06 AC 92 ms 23380 KB
b07 AC 91 ms 19540 KB
b08 AC 91 ms 19924 KB
b09 AC 101 ms 18640 KB
b10 AC 107 ms 19668 KB
b11 AC 101 ms 19668 KB
b12 AC 93 ms 20692 KB
b13 AC 93 ms 19028 KB
b14 AC 92 ms 18644 KB
b15 AC 100 ms 19796 KB
b16 AC 103 ms 19668 KB
b17 AC 101 ms 23124 KB
b18 AC 94 ms 19796 KB
b19 AC 94 ms 21460 KB
b20 AC 93 ms 20684 KB
b21 AC 101 ms 19668 KB
b22 AC 101 ms 18644 KB
b23 AC 102 ms 19412 KB
b24 AC 100 ms 18644 KB