Submission #214605


Source Code Expand

Copy
import java.util.Scanner;

public class Main {
	
	static int N;
	static int H;
	
	static int A;
	static int B;
	static int C;
	static int D;
	static int E;
	
	
	public static int d(int n,int h){
		if(n == 1){
			if(h > E){
				return 0;
			}else{
				return C;
			}
		}else{
			if(h > E){
				return d(n-1,h-E);
			}else{
				int r = A + d(n-1,h+B);
				int p = C + d(n-1,h+D);
				return Math.min(r, p);
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		H = sc.nextInt();
		
		A = sc.nextInt();
		B = sc.nextInt();
		C = sc.nextInt();
		D = sc.nextInt();
		E = sc.nextInt();

		System.out.println(d(N,H));

	}

}

Submission Info

Submission Time
Task C - 節制
User jimjin
Language Java (OpenJDK 1.7.0)
Score 10
Code Size 728 Byte
Status TLE
Exec Time 2067 ms
Memory 37512 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 0 / 30 0 / 60 0 / 1
Status
AC × 25
AC × 19
TLE × 6
AC × 46
TLE × 40
AC × 43
TLE × 56
Set Name Test Cases
Subtask1 sample_1.txt, sample_2.txt, sample_3.txt, 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt
Subtask3 sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt, 03_010.txt, 03_011.txt, 03_012.txt, 03_020.txt, 03_021.txt, 03_022.txt, 03_100.txt, 03_101.txt, 03_102.txt, 03_110.txt, 03_111.txt, 03_112.txt, 03_200.txt, 03_201.txt, 03_202.txt, 03_220.txt, 03_221.txt, 03_222.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt, 03_random16.txt, 03_random17.txt, 03_random18.txt, 03_random19.txt, 03_random20.txt
Subtask4 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt, 03_010.txt, 03_011.txt, 03_012.txt, 03_020.txt, 03_021.txt, 03_022.txt, 03_100.txt, 03_101.txt, 03_102.txt, 03_110.txt, 03_111.txt, 03_112.txt, 03_200.txt, 03_201.txt, 03_202.txt, 03_220.txt, 03_221.txt, 03_222.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt, 03_random16.txt, 03_random17.txt, 03_random18.txt, 03_random19.txt, 03_random20.txt, 04_010.txt, 04_011.txt, 04_020.txt, 04_021.txt, 04_100.txt, 04_101.txt, 04_110.txt, 04_111.txt, 04_200.txt, 04_201.txt, 04_220.txt, 04_221.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt
Case Name Status Exec Time Memory
01_010.txt AC 439 ms 23220 KB
01_011.txt AC 457 ms 23216 KB
01_020.txt AC 447 ms 23216 KB
01_021.txt AC 456 ms 23212 KB
01_100.txt AC 458 ms 23088 KB
01_101.txt AC 464 ms 23216 KB
01_110.txt AC 462 ms 23220 KB
01_111.txt AC 459 ms 23216 KB
01_200.txt AC 465 ms 23216 KB
01_201.txt AC 458 ms 23220 KB
01_220.txt AC 449 ms 23208 KB
01_221.txt AC 454 ms 23172 KB
01_random01.txt AC 462 ms 23216 KB
01_random02.txt AC 462 ms 23216 KB
01_random03.txt AC 446 ms 23216 KB
01_random04.txt AC 448 ms 23208 KB
01_random05.txt AC 450 ms 23216 KB
01_random06.txt AC 445 ms 23092 KB
01_random07.txt AC 453 ms 23180 KB
01_random08.txt AC 442 ms 23216 KB
01_random09.txt AC 446 ms 23092 KB
01_random10.txt AC 461 ms 23212 KB
02_010.txt TLE 2036 ms 23684 KB
02_011.txt TLE 2035 ms 23860 KB
02_020.txt AC 440 ms 23092 KB
02_021.txt TLE 2036 ms 23820 KB
02_100.txt TLE 2037 ms 23772 KB
02_101.txt AC 467 ms 23472 KB
02_110.txt AC 450 ms 23212 KB
02_111.txt AC 991 ms 23468 KB
02_200.txt TLE 2036 ms 23820 KB
02_201.txt AC 469 ms 23084 KB
02_220.txt AC 453 ms 23088 KB
02_221.txt AC 564 ms 23352 KB
02_random01.txt AC 458 ms 23212 KB
02_random02.txt AC 471 ms 23348 KB
02_random03.txt AC 454 ms 23220 KB
02_random04.txt AC 708 ms 23520 KB
02_random05.txt TLE 2037 ms 23812 KB
02_random06.txt AC 445 ms 23220 KB
02_random07.txt AC 467 ms 23348 KB
02_random08.txt AC 463 ms 23336 KB
02_random09.txt AC 463 ms 23472 KB
02_random10.txt AC 455 ms 23480 KB
03_010.txt TLE 2036 ms 23812 KB
03_011.txt TLE 2037 ms 23816 KB
03_012.txt TLE 2037 ms 23688 KB
03_020.txt TLE 2036 ms 23812 KB
03_021.txt TLE 2045 ms 23684 KB
03_022.txt TLE 2042 ms 23816 KB
03_100.txt TLE 2037 ms 23824 KB
03_101.txt TLE 2037 ms 23820 KB
03_102.txt TLE 2036 ms 23940 KB
03_110.txt TLE 2037 ms 23692 KB
03_111.txt TLE 2037 ms 23764 KB
03_112.txt TLE 2037 ms 23692 KB
03_200.txt TLE 2037 ms 23816 KB
03_201.txt TLE 2038 ms 23748 KB
03_202.txt TLE 2037 ms 23820 KB
03_220.txt TLE 2037 ms 23804 KB
03_221.txt TLE 2037 ms 23680 KB
03_222.txt TLE 2036 ms 23836 KB
03_random01.txt TLE 2037 ms 23688 KB
03_random02.txt AC 444 ms 23204 KB
03_random03.txt TLE 2036 ms 23744 KB
03_random04.txt TLE 2036 ms 23816 KB
03_random05.txt AC 443 ms 23084 KB
03_random06.txt TLE 2038 ms 23844 KB
03_random07.txt TLE 2037 ms 23656 KB
03_random08.txt TLE 2039 ms 23816 KB
03_random09.txt TLE 2035 ms 23816 KB
03_random10.txt AC 448 ms 23084 KB
03_random11.txt TLE 2035 ms 23692 KB
03_random12.txt TLE 2036 ms 23812 KB
03_random13.txt TLE 2037 ms 23812 KB
03_random14.txt TLE 2035 ms 23824 KB
03_random15.txt AC 452 ms 23220 KB
03_random16.txt TLE 2037 ms 23936 KB
03_random17.txt TLE 2036 ms 23944 KB
03_random18.txt TLE 2038 ms 23684 KB
03_random19.txt TLE 2037 ms 23684 KB
03_random20.txt AC 457 ms 23088 KB
04_010.txt TLE 2064 ms 37252 KB
04_011.txt TLE 2066 ms 37000 KB
04_020.txt TLE 2063 ms 36364 KB
04_021.txt TLE 2063 ms 36476 KB
04_100.txt TLE 2063 ms 37512 KB
04_101.txt TLE 2058 ms 34952 KB
04_110.txt TLE 2053 ms 32512 KB
04_111.txt TLE 2055 ms 31620 KB
04_200.txt TLE 2041 ms 27012 KB
04_201.txt TLE 2036 ms 24712 KB
04_220.txt TLE 2044 ms 28940 KB
04_221.txt TLE 2060 ms 35212 KB
04_random01.txt TLE 2038 ms 25604 KB
04_random02.txt TLE 2042 ms 27776 KB
04_random03.txt TLE 2052 ms 31240 KB
04_random04.txt TLE 2067 ms 36364 KB
04_random05.txt TLE 2045 ms 29048 KB
sample_1.txt AC 477 ms 23216 KB
sample_2.txt AC 458 ms 23220 KB
sample_3.txt AC 491 ms 23220 KB
sample_4.txt TLE 2036 ms 23816 KB