Submission #60591


Source Code Expand

import java.util.Arrays;

public class Main {

	void run() {
		Scanner sc = new Scanner();
		long n1 = sc.nextLong(), n2 = sc.nextLong(), n3 = sc.nextLong(), n4 = sc.nextLong(), n5 = sc.nextLong();
		long u1 = 0, u2 = 0;
		long res = 0;
		res = n5;
		n5 = 0;
		res+=n4;
		u1 = 61*n4;
		n4 = 0;
		res+=n3;
		u2 = 7*n3; u1+=42*n3;
		long t = Math.min(n2, u2);
		n2-=t; u2-=t;
//		System.out.println(n2+" "+u2);
		if(n2>0){
			if(n2%8==0){
				long k = n2/8;
				res+=k; u1+=61*k;
			}
			else{
				long k = (n2-1)/8;
				res+=k; u1+=61*k;
				res++;
				long mod = n2%8;
				u1+=125-8*mod;
			}
		}
		u1+=u2*8;
//		System.out.println(n1+" "+u1);
		t = Math.min(n1, u1);
		n1-=t;
		if(n1>0)res+=(n1-1)/125+1;
		System.out.println(res);
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	 class Scanner {
			int nextInt() {
				try {
					int c = System.in.read();
					while (c != '-' && (c < '0' || '9' < c))
						c = System.in.read();
					if (c == '-') return -nextInt();
					int res = 0;
					do {
						res *= 10;
						res += c - '0';
						c = System.in.read();
					} while ('0' <= c && c <= '9');
					return res;
				} catch (Exception e) {
					return -1;
				}
			}
			long nextLong() {
				try {
					int c = System.in.read();
					while (c != '-' && (c < '0' || '9' < c))
						c = System.in.read();
					if (c == '-') return -nextLong();
					long res = 0;
					do {
						res *= 10;
						res += c - '0';
						c = System.in.read();
					} while ('0' <= c && c <= '9');
					return res;
				} catch (Exception e) {
					return -1;
				}
			}
			double nextDouble() {
				return Double.parseDouble(next());
			}
			String next() {
				try {
					StringBuilder res = new StringBuilder("");
					int c = System.in.read();
					while (Character.isWhitespace(c))
						c = System.in.read();
					do {
						res.append((char) c);
					} while (!Character.isWhitespace(c = System.in.read()));
					return res.toString();
				} catch (Exception e) {
					return null;
				}
			}
			String nextLine(){
				try{
					StringBuilder res =new StringBuilder("");
					int c = System.in.read();
					while (c=='\r' || c=='\n')
						c = System.in.read();
					do {
						res.append((char) c);
						c = System.in.read();
					} while (c!='\r' && c!='\n');
					return res.toString();
				}catch (Exception e) {
					return null;
				}
			}
		}
	
	public static void main(String... args) {
		new Main().run();
	}
}

Submission Info

Submission Time
Task D - 5キューブ
User nanikaka
Language Java (OpenJDK 1.7.0)
Score 75
Code Size 2560 Byte
Status AC
Exec Time 432 ms
Memory 18516 KB

Judge Result

Set Name All
Score / Max Score 75 / 75
Status
AC × 63
Set Name Test Cases
All case_000.txt, case_001.txt, case_002.txt, case_003.txt, case_004.txt, case_005.txt, case_006.txt, case_007.txt, case_008.txt, case_009.txt, case_010.txt, case_011.txt, case_012.txt, case_013.txt, case_014.txt, case_015.txt, case_016.txt, case_017.txt, case_018.txt, case_019.txt, case_020.txt, case_021.txt, case_022.txt, case_023.txt, case_024.txt, case_025.txt, case_026.txt, case_027.txt, case_028.txt, case_029.txt, case_030.txt, case_031.txt, case_032.txt, case_033.txt, case_034.txt, case_035.txt, case_036.txt, case_037.txt, case_038.txt, case_039.txt, case_040.txt, case_041.txt, case_042.txt, case_043.txt, case_044.txt, case_045.txt, case_046.txt, case_047.txt, case_048.txt, case_049.txt, case_050.txt, case_051.txt, case_052.txt, case_053.txt, case_054.txt, case_055.txt, case_056.txt, case_057.txt, case_058.txt, case_059.txt, case_060.txt, case_061.txt, case_062.txt
Case Name Status Exec Time Memory
case_000.txt AC 388 ms 18356 KB
case_001.txt AC 386 ms 18480 KB
case_002.txt AC 388 ms 18472 KB
case_003.txt AC 371 ms 18356 KB
case_004.txt AC 379 ms 18480 KB
case_005.txt AC 378 ms 18352 KB
case_006.txt AC 393 ms 18352 KB
case_007.txt AC 391 ms 18352 KB
case_008.txt AC 379 ms 18472 KB
case_009.txt AC 375 ms 18460 KB
case_010.txt AC 384 ms 18356 KB
case_011.txt AC 376 ms 18472 KB
case_012.txt AC 380 ms 18356 KB
case_013.txt AC 384 ms 18488 KB
case_014.txt AC 374 ms 18476 KB
case_015.txt AC 376 ms 18472 KB
case_016.txt AC 372 ms 18360 KB
case_017.txt AC 374 ms 18344 KB
case_018.txt AC 370 ms 18480 KB
case_019.txt AC 386 ms 18356 KB
case_020.txt AC 377 ms 18352 KB
case_021.txt AC 379 ms 18472 KB
case_022.txt AC 369 ms 18356 KB
case_023.txt AC 370 ms 18480 KB
case_024.txt AC 375 ms 18400 KB
case_025.txt AC 374 ms 18396 KB
case_026.txt AC 371 ms 18388 KB
case_027.txt AC 371 ms 18360 KB
case_028.txt AC 381 ms 18484 KB
case_029.txt AC 387 ms 18344 KB
case_030.txt AC 395 ms 18348 KB
case_031.txt AC 395 ms 18360 KB
case_032.txt AC 374 ms 18492 KB
case_033.txt AC 372 ms 18516 KB
case_034.txt AC 378 ms 18480 KB
case_035.txt AC 371 ms 18348 KB
case_036.txt AC 377 ms 18472 KB
case_037.txt AC 379 ms 18384 KB
case_038.txt AC 384 ms 18468 KB
case_039.txt AC 387 ms 18404 KB
case_040.txt AC 375 ms 18348 KB
case_041.txt AC 376 ms 18364 KB
case_042.txt AC 374 ms 18456 KB
case_043.txt AC 375 ms 18484 KB
case_044.txt AC 377 ms 18488 KB
case_045.txt AC 387 ms 18476 KB
case_046.txt AC 379 ms 18488 KB
case_047.txt AC 380 ms 18404 KB
case_048.txt AC 423 ms 18476 KB
case_049.txt AC 398 ms 18460 KB
case_050.txt AC 422 ms 18464 KB
case_051.txt AC 387 ms 18476 KB
case_052.txt AC 432 ms 18408 KB
case_053.txt AC 423 ms 18484 KB
case_054.txt AC 385 ms 18356 KB
case_055.txt AC 377 ms 18488 KB
case_056.txt AC 380 ms 18360 KB
case_057.txt AC 384 ms 18460 KB
case_058.txt AC 374 ms 18360 KB
case_059.txt AC 374 ms 18352 KB
case_060.txt AC 372 ms 18360 KB
case_061.txt AC 390 ms 18476 KB
case_062.txt AC 377 ms 18480 KB