結果

問題 No.313 π
ユーザー uafr_csuafr_cs
提出日時 2015-12-06 00:16:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 5,000 ms
コード長 1,688 bytes
コンパイル時間 2,482 ms
コンパイル使用メモリ 75,564 KB
実行使用メモリ 55,968 KB
最終ジャッジ日時 2023-10-12 16:16:27
合計ジャッジ時間 9,383 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
55,516 KB
testcase_01 AC 169 ms
55,668 KB
testcase_02 AC 165 ms
54,564 KB
testcase_03 AC 164 ms
55,328 KB
testcase_04 AC 164 ms
55,552 KB
testcase_05 AC 156 ms
53,940 KB
testcase_06 AC 163 ms
54,216 KB
testcase_07 AC 161 ms
54,076 KB
testcase_08 AC 164 ms
54,304 KB
testcase_09 AC 165 ms
54,808 KB
testcase_10 AC 168 ms
53,276 KB
testcase_11 AC 166 ms
54,360 KB
testcase_12 AC 170 ms
54,560 KB
testcase_13 AC 168 ms
55,968 KB
testcase_14 AC 167 ms
55,612 KB
testcase_15 AC 167 ms
54,972 KB
testcase_16 AC 173 ms
54,536 KB
testcase_17 AC 152 ms
53,728 KB
testcase_18 AC 166 ms
55,156 KB
testcase_19 AC 167 ms
54,952 KB
testcase_20 AC 151 ms
54,360 KB
testcase_21 AC 150 ms
53,980 KB
testcase_22 AC 164 ms
54,180 KB
testcase_23 AC 167 ms
53,824 KB
testcase_24 AC 163 ms
54,844 KB
testcase_25 AC 164 ms
55,656 KB
testcase_26 AC 166 ms
55,272 KB
testcase_27 AC 163 ms
55,300 KB
testcase_28 AC 170 ms
55,004 KB
testcase_29 AC 165 ms
54,340 KB
testcase_30 AC 166 ms
54,532 KB
testcase_31 AC 156 ms
54,564 KB
testcase_32 AC 164 ms
55,220 KB
testcase_33 AC 171 ms
55,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	
	static int[] counts = new int[]{
			20104,
			20063,
			19892,
			20011,
			19874,
			20199,
			19898,
			20163,
			19956,
			19841
	};
	
	public static int[] process(char[] inputs, boolean output){
		int[] arr = new int[10];
		for(final char ch : inputs){
			if(!Character.isDigit(ch)){ continue; }
			
			arr[Character.getNumericValue(ch)]++;
		}
		
		if(!output){ return arr; }
		
		
		for(final int a : arr){ System.out.println(a + ","); }
		
		return arr;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		char[] input = sc.next().toCharArray();
		boolean debug = false;
		
		int[] arr = process(input, debug);
		
		
		int less = -1, more = -1;
		for(int i = 0; i < 10; i++){
			if(counts[i] < arr[i]){
				more = i;
			}else if(counts[i] > arr[i]){
				less = i;
			}
		}
		
		System.out.println(more + " " + less);
	}
	
	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() {
			try {
				while (!hasNext()) {tok = new StringTokenizer(br.readLine());}
			} catch(IOException e){ /* ignore */ }
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() {
			getLine(); return tok.nextToken();
		}

		public int nextInt(){
			return Integer.parseInt(next());
		}

		public void close() {
			try{ br.close(); } catch (IOException e){ /*ignore*/ }
		}
	}
}
0