Submission #3238620


Source Code Expand

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		boolean bl = false;
		int a = 0;
		int b = 0;
		for(int i=0; i<=n; i++){
			for(int j=0; j<=n-i; j++){
				if(10000*i+5000*j+1000*(n-i-j)==y){
					a = i;
					b = j;
					bl = true;
					break;
				}
			}
			if(bl==true)break;
		}
		System.out.println(bl==true ? a +" "+ b + " " + (n-a-b) : "-1 -1 -1" );
	}
}

Submission Info

Submission Time
Task C - Otoshidama
User Ricky_pon
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 501 Byte
Status AC
Exec Time 101 ms
Memory 22608 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 92 ms 21844 KB
a02 AC 93 ms 22608 KB
a03 AC 94 ms 18900 KB
a04 AC 100 ms 21204 KB
b05 AC 92 ms 20564 KB
b06 AC 93 ms 21204 KB
b07 AC 94 ms 18900 KB
b08 AC 92 ms 19796 KB
b09 AC 100 ms 18644 KB
b10 AC 101 ms 21332 KB
b11 AC 100 ms 21204 KB
b12 AC 92 ms 18644 KB
b13 AC 92 ms 21076 KB
b14 AC 94 ms 18900 KB
b15 AC 100 ms 20820 KB
b16 AC 100 ms 20564 KB
b17 AC 100 ms 19284 KB
b18 AC 92 ms 19668 KB
b19 AC 92 ms 19924 KB
b20 AC 93 ms 21204 KB
b21 AC 99 ms 20564 KB
b22 AC 100 ms 19668 KB
b23 AC 99 ms 21844 KB
b24 AC 100 ms 17748 KB