第2回 ドワンゴからの挑戦状 予選

Submission #615908

Source codeソースコード

import java.io.*;
import java.util.*;
 
public class Main{
	public void solve(){
		int N = nextInt();
		int prev = 1000000000;
		for(int i = 1; i < N; i++){
			int tmp = nextInt();
			out.print(Math.min(prev, tmp));
			out.print(" ");
			prev = tmp;
		}
		out.println(prev);
		
	}

	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Submission

Task問題 B - 積み鉛筆
User nameユーザ名 a3636tako
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 80
Source lengthソースコード長 2066 Byte
File nameファイル名
Exec time実行時間 602 ms
Memory usageメモリ使用量 34400 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample1.txt,sample2.txt,sample3.txt
All 80 / 80 subtask0_0.txt,subtask0_1.txt,subtask0_10.txt,subtask0_11.txt,subtask0_12.txt,subtask0_13.txt,subtask0_14.txt,subtask0_2.txt,subtask0_3.txt,subtask0_4.txt,subtask0_5.txt,subtask0_6.txt,subtask0_7.txt,subtask0_8.txt,subtask0_9.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample1.txt AC 448 ms 22356 KB
sample2.txt AC 302 ms 22368 KB
sample3.txt AC 302 ms 22412 KB
subtask0_0.txt AC 499 ms 34304 KB
subtask0_1.txt AC 510 ms 33616 KB
subtask0_10.txt AC 499 ms 33996 KB
subtask0_11.txt AC 507 ms 34072 KB
subtask0_12.txt AC 602 ms 33856 KB
subtask0_13.txt AC 493 ms 34008 KB
subtask0_14.txt AC 514 ms 34360 KB
subtask0_2.txt AC 489 ms 34100 KB
subtask0_3.txt AC 498 ms 34312 KB
subtask0_4.txt AC 500 ms 34048 KB
subtask0_5.txt AC 491 ms 33584 KB
subtask0_6.txt AC 500 ms 34200 KB
subtask0_7.txt AC 493 ms 33984 KB
subtask0_8.txt AC 511 ms 34400 KB
subtask0_9.txt AC 512 ms 34396 KB