AtCoder Beginner Contest 019

Submission #345163

Source codeソースコード

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;



public class Main{
	
	// ArrayList<Integer> lis = new ArrayList<Integer>();
	// ArrayList<String> lis = new ArrayList<String>();
	// PriorityQueue<P> que = new PriorityQueue<P>();
	// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
	//  Stack<Integer> que = new Stack<Integer>();
	//HashMap<Long,Long> map = new HashMap<Long,Long>();
    //	static long sum=0;
	// 1000000007 (10^9+7)
	static int mod = 1000000007;
	//static int mod = 1000000009; ArrayList<Integer> l[]= new ArrayList[n];
 //   static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};
//	static int dx[]={1,-1,0,0,1,1,-1,-1};
//  static int dy[]={0,0,1,-1,1,-1,1,-1};
	
	//static Set<Integer> set = new HashSet<Integer>();
	//static ArrayList<Integer> l[];
    //static int parent[][],depth[],node,max_log;
//   static ArrayList<Integer> nd[]= new ArrayList[2001];

public  static void main(String[] args)   throws Exception, IOException{

	//Scanner sc =new Scanner(System.in);
	
	Reader sc = new Reader(System.in);
   

	//int n=sc.nextInt();//,m=sc.nextInt(),k=sc.nextInt();
	//int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
	
	int n=sc.nextInt();//,k=sc.nextInt(),s=0;
	HashSet<Integer> set = new HashSet<Integer>();
	
	for (int i = 0; i < n; i++) {
		int x=sc.nextInt();
		while(x%2==0)x/=2;
		set.add(x);
	}
System.out.println(set.size());
}



 

/*
  static class P implements Comparable<P>{
	int id, d; ;
	P(int id,int d){
		this.id=id;
		this.d=d;
	} 
	
	public int compareTo(P x){
	//	return  (-x.d+d)>=0?1:-1  ; // ascend long
	//	return   -x.d+d  ; // ascend
		 return   x.d-d  ; //descend
	   }
 
}//*/


static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static boolean validpos(int x,int y,int r, int c){
	
	return x<r && 0<=x && y<c && 0<=y;
	
}

static boolean bit(int x,int k){
	// weather k-th bit (from right) be one or zero
	return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
}


}




class Reader
{ 
	private BufferedReader x;
	private StringTokenizer st;
	
	public Reader(InputStream in)
	{
		x = new BufferedReader(new InputStreamReader(in));
		st = null;
	}
	public String nextString() throws IOException
	{
		while( st==null || !st.hasMoreTokens() )
			st = new StringTokenizer(x.readLine());
		return st.nextToken();
	}
	public int nextInt() throws IOException
	{
		return Integer.parseInt(nextString());
	}
	public long nextLong() throws IOException
	{
		return Long.parseLong(nextString());
	}
	public double nextDouble() throws IOException
	{
		return Double.parseDouble(nextString());
	}
}

Submission

Task問題 C - 高橋くんと魔法の箱
User nameユーザ名 koji_t
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 2823 Byte
File nameファイル名
Exec time実行時間 1022 ms
Memory usageメモリ使用量 38140 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 384 ms 20640 KB
subtask0_1.txt AC 298 ms 20616 KB
subtask0_2.txt AC 297 ms 20636 KB
subtask1_0.txt AC 355 ms 24180 KB
subtask1_1.txt AC 364 ms 24200 KB
subtask1_10.txt AC 367 ms 24196 KB
subtask1_11.txt AC 381 ms 24500 KB
subtask1_12.txt AC 374 ms 24552 KB
subtask1_13.txt AC 374 ms 24236 KB
subtask1_14.txt AC 1022 ms 24260 KB
subtask1_15.txt AC 390 ms 24168 KB
subtask1_16.txt AC 386 ms 24256 KB
subtask1_17.txt AC 470 ms 24160 KB
subtask1_18.txt AC 387 ms 24520 KB
subtask1_19.txt AC 446 ms 24256 KB
subtask1_2.txt AC 382 ms 24172 KB
subtask1_3.txt AC 443 ms 24284 KB
subtask1_4.txt AC 455 ms 24260 KB
subtask1_5.txt AC 361 ms 24348 KB
subtask1_6.txt AC 365 ms 23952 KB
subtask1_7.txt AC 361 ms 24292 KB
subtask1_8.txt AC 362 ms 24572 KB
subtask1_9.txt AC 366 ms 24600 KB
subtask2_0.txt AC 539 ms 37864 KB
subtask2_1.txt AC 556 ms 37340 KB
subtask2_2.txt AC 564 ms 37156 KB
subtask2_3.txt AC 595 ms 36860 KB
subtask2_4.txt AC 567 ms 37748 KB
subtask2_5.txt AC 614 ms 37536 KB
subtask2_6.txt AC 550 ms 37384 KB
subtask2_7.txt AC 545 ms 37128 KB
subtask2_8.txt AC 582 ms 37452 KB
subtask2_9.txt AC 566 ms 37600 KB
subtask3_0.txt AC 559 ms 37676 KB
subtask3_1.txt AC 579 ms 37656 KB
subtask3_2.txt AC 550 ms 38040 KB
subtask3_3.txt AC 623 ms 37724 KB
subtask3_4.txt AC 606 ms 37720 KB
subtask3_5.txt AC 635 ms 38140 KB
subtask3_6.txt AC 624 ms 37800 KB
subtask3_7.txt AC 726 ms 37736 KB
subtask3_8.txt AC 568 ms 38004 KB
subtask3_9.txt AC 691 ms 37788 KB