AtCoder Beginner Contest 001

Submission #4434532

Source codeソースコード

import java.util.*;
import java.io.*;

class Main {
	void solve () {

		int n = nextInt();
		int ans = 0;
		
		if (n < 100) {
			ans = 0;
		}
		else if (100<=n && n<=5000) {
			ans = n/100;
		}
		else if (6000<=n && n<=30000) {
			ans = n/1000 + 50;
		}
		else if (35000<=n && n<=70000) {
			ans = (n/1000-30)/5 + 80;
		}
		else if (70 < n) {
			ans = 89;
		}
		
		out.println(String.format("%02d", ans));
		

	}



	// <Main Method>
	public static PrintWriter out;
	public static void main(String[] args) {
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}

	// <Default Field>
	static int maxInt = Integer.MAX_VALUE, minInt = Integer.MIN_VALUE;
	static double pi = Math.PI;
	static int mod = 1000000007;

	// <Default Method>
	static int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}
	static int min (int... ar) {Arrays.sort(ar);return ar[0];}
	static int calcManhatDistance (int x1, int y1, int x2, int y2) {
		int d = Math.abs(x1-x2)+Math.abs(y1-y2);
		return d;
	}
	static double calcEuclidDistance (double x1, double y1, double x2, double y2) {
		double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		return d;
	}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
	static void printChar2DArray (char[][] ar) {
		for (int i=0; i<ar.length; i++) {
			for (int j=0; j<ar[0].length; j++) {
				out.print(ar[i][j]);
			}
			out.println();
		}
	}
	static void printIntArray (int[] ar) {
		for (int i=0; i<ar.length; i++) {
			out.print((i==0?"":" ")+ar[i]);
		}
		out.println();
	}
	static void printlnIntArray (int[] ar) {
		for (int i=0; i<ar.length; i++) {
			out.println(ar[i]);
		}
	}
	static long sumIntArray (int[] ar) {
		long sum = 0;
		for (int i=0; i<ar.length; i++) {
			sum += ar[i];
		}
		return sum;
	}

	// <Fast Scanner> START -------------------------------------------------
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length <= 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static String[] nextStringArray (int n) {
		String[] ar = new String[n];
		for (int i=0; i<n; i++) ar[i] = next();
		return ar;
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextIntArray (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			else throw new NumberFormatException();
			temp = readByte();
		}
		return minus? -n : n;
	}
	public static double nextDouble () {
		return Double.parseDouble(next());
	}
	public static char[][] nextChar2DArray (int h, int w, boolean b) {
		//b(番兵)がtrueなら配列を余計に確保する
		char[][] ar = new char[b?h+2:h][b?w+2:h];
		for (int i=b?1:0; i<(b?h+1:h); i++) {
			String temp = next();
			for (int j=0; j<w; j++) {
				ar[i][b?j+1:j] = temp.charAt(j);
			}
		}
		return ar;
	}
	// <Fast Scanner> END ----------------------------------------------------------
}

Submission

Task問題 B - 視程の通報
User nameユーザ名 Yukimoto
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 4372 Byte
File nameファイル名
Exec time実行時間 77 ms
Memory usageメモリ使用量 21716 KB

Test case

Set

Set name Score得点 / Max score Cases
all 100 / 100 00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,test_01.txt,test_02.txt,test_03.txt,test_04.txt,test_05.txt,test_06.txt,test_07.txt,test_08.txt,test_09.txt,test_10.txt,test_11.txt,test_12.txt,test_13.txt,test_14.txt,test_15.txt,test_16.txt,test_17.txt,test_18.txt,test_19.txt,test_20.txt,test_21.txt,test_22.txt,test_23.txt,test_24.txt,test_25.txt,test_26.txt,test_27.txt,test_28.txt,test_29.txt,test_30.txt,test_31.txt,test_32.txt,test_33.txt,test_34.txt,test_35.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 76 ms 20948 KB
00_sample_02.txt AC 75 ms 21332 KB
00_sample_03.txt AC 74 ms 17620 KB
test_01.txt AC 73 ms 15956 KB
test_02.txt AC 76 ms 20436 KB
test_03.txt AC 76 ms 19156 KB
test_04.txt AC 75 ms 18644 KB
test_05.txt AC 75 ms 16340 KB
test_06.txt AC 73 ms 19284 KB
test_07.txt AC 73 ms 21204 KB
test_08.txt AC 75 ms 18132 KB
test_09.txt AC 77 ms 20692 KB
test_10.txt AC 76 ms 19156 KB
test_11.txt AC 74 ms 17620 KB
test_12.txt AC 75 ms 21204 KB
test_13.txt AC 74 ms 19284 KB
test_14.txt AC 75 ms 20180 KB
test_15.txt AC 76 ms 18516 KB
test_16.txt AC 75 ms 18260 KB
test_17.txt AC 75 ms 21332 KB
test_18.txt AC 73 ms 19540 KB
test_19.txt AC 74 ms 20692 KB
test_20.txt AC 75 ms 21204 KB
test_21.txt AC 76 ms 20308 KB
test_22.txt AC 75 ms 18260 KB
test_23.txt AC 74 ms 18132 KB
test_24.txt AC 74 ms 17620 KB
test_25.txt AC 74 ms 21332 KB
test_26.txt AC 72 ms 17620 KB
test_27.txt AC 75 ms 18900 KB
test_28.txt AC 74 ms 17748 KB
test_29.txt AC 77 ms 21716 KB
test_30.txt AC 75 ms 18644 KB
test_31.txt AC 75 ms 19412 KB
test_32.txt AC 76 ms 19540 KB
test_33.txt AC 75 ms 17748 KB
test_34.txt AC 74 ms 20308 KB
test_35.txt AC 77 ms 21204 KB