Hpu赛题-A Math Problem

题目链接:http://8be0ed4d.ngrok.io/contest/1/problem/A

这道题应该算是比较水的题吧,但是我害怕Scanner输入过不了,就用了缓冲,直接上代码:

import java.io.*;
import java.util.*;
public class Main {
	static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	public static void main(String args[]) throws IOException{
		int t=getInt();
		while(t--!=0){
			int n=getInt();
			int k=getInt();
			long sum=0;
			while(n--!=0){
				long a=getInt();
				sum+=a/k;
			}
			System.out.println(sum);
		}	
	}
	static int getInt() throws IOException{
		in.nextToken();
		return (int) in.nval;
	}
}

猜你喜欢

转载自blog.csdn.net/King8611/article/details/81433860