AtCoder Beginner Contest 019

Submission #347071

Source codeソースコード

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < N; i++) {
			int a = sc.nextInt();
			
			set.add(a >> Integer.numberOfTrailingZeros(a));
		}
		System.out.println(set.size());
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

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

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

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

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

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

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Submission

Task問題 C - 高橋くんと魔法の箱
User nameユーザ名 もにょーん
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1550 Byte
File nameファイル名
Exec time実行時間 651 ms
Memory usageメモリ使用量 37404 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
Subtask1 20 / 20 subtask1_0.txt,subtask1_1.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_2.txt,subtask1_3.txt,subtask1_4.txt,subtask1_5.txt,subtask1_6.txt,subtask1_7.txt,subtask1_8.txt,subtask1_9.txt,subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
Subtask2 30 / 30 subtask2_0.txt,subtask2_1.txt,subtask2_2.txt,subtask2_3.txt,subtask2_4.txt,subtask2_5.txt,subtask2_6.txt,subtask2_7.txt,subtask2_8.txt,subtask2_9.txt,subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
All 50 / 50 subtask0_0.txt,subtask0_1.txt,subtask0_2.txt,subtask1_0.txt,subtask1_1.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_2.txt,subtask1_3.txt,subtask1_4.txt,subtask1_5.txt,subtask1_6.txt,subtask1_7.txt,subtask1_8.txt,subtask1_9.txt,subtask2_0.txt,subtask2_1.txt,subtask2_2.txt,subtask2_3.txt,subtask2_4.txt,subtask2_5.txt,subtask2_6.txt,subtask2_7.txt,subtask2_8.txt,subtask2_9.txt,subtask3_0.txt,subtask3_1.txt,subtask3_2.txt,subtask3_3.txt,subtask3_4.txt,subtask3_5.txt,subtask3_6.txt,subtask3_7.txt,subtask3_8.txt,subtask3_9.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_0.txt AC 329 ms 20348 KB
subtask0_1.txt AC 308 ms 20400 KB
subtask0_2.txt AC 312 ms 20324 KB
subtask1_0.txt AC 381 ms 24004 KB
subtask1_1.txt AC 371 ms 23952 KB
subtask1_10.txt AC 377 ms 24084 KB
subtask1_11.txt AC 384 ms 24292 KB
subtask1_12.txt AC 384 ms 24304 KB
subtask1_13.txt AC 382 ms 24040 KB
subtask1_14.txt AC 378 ms 23952 KB
subtask1_15.txt AC 371 ms 24280 KB
subtask1_16.txt AC 380 ms 24240 KB
subtask1_17.txt AC 374 ms 24252 KB
subtask1_18.txt AC 366 ms 24252 KB
subtask1_19.txt AC 373 ms 24236 KB
subtask1_2.txt AC 363 ms 24236 KB
subtask1_3.txt AC 357 ms 24292 KB
subtask1_4.txt AC 358 ms 24304 KB
subtask1_5.txt AC 361 ms 24132 KB
subtask1_6.txt AC 372 ms 23988 KB
subtask1_7.txt AC 376 ms 23804 KB
subtask1_8.txt AC 367 ms 24028 KB
subtask1_9.txt AC 361 ms 24068 KB
subtask2_0.txt AC 557 ms 37052 KB
subtask2_1.txt AC 651 ms 37132 KB
subtask2_2.txt AC 600 ms 37212 KB
subtask2_3.txt AC 561 ms 37252 KB
subtask2_4.txt AC 553 ms 37272 KB
subtask2_5.txt AC 535 ms 37168 KB
subtask2_6.txt AC 568 ms 36892 KB
subtask2_7.txt AC 538 ms 37088 KB
subtask2_8.txt AC 561 ms 37328 KB
subtask2_9.txt AC 566 ms 37292 KB
subtask3_0.txt AC 583 ms 37120 KB
subtask3_1.txt AC 565 ms 37372 KB
subtask3_2.txt AC 585 ms 37404 KB
subtask3_3.txt AC 571 ms 37360 KB
subtask3_4.txt AC 585 ms 37072 KB
subtask3_5.txt AC 582 ms 37036 KB
subtask3_6.txt AC 593 ms 36864 KB
subtask3_7.txt AC 588 ms 37360 KB
subtask3_8.txt AC 586 ms 37380 KB
subtask3_9.txt AC 567 ms 37260 KB