結果

提出番号 1681
提出者 fal_rnd
言語 Java
提出日時 2018-08-04 13:27:55
問題名 (69)机の配置
結果 AC
点数 100%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 172ms 121536KB
2 AC 100% 152ms 121888KB
3 AC 100% 213ms 121536KB
4 AC 100% 191ms 121120KB
5 AC 100% 157ms 124464KB
6 AC 100% 174ms 120656KB
7 AC 100% 175ms 122160KB
8 AC 100% 148ms 121712KB
9 AC 100% 183ms 122656KB
10 AC 100% 144ms 123344KB
11 AC 100% 173ms 123296KB
12 AC 100% 150ms 122640KB
13 AC 100% 155ms 123056KB
14 AC 100% 149ms 122704KB
15 AC 100% 160ms 122352KB
16 AC 100% 170ms 120512KB
17 AC 100% 166ms 123424KB
18 AC 100% 153ms 123088KB
19 AC 100% 154ms 121568KB
20 AC 100% 159ms 122800KB
21 AC 100% 170ms 124176KB
22 AC 100% 168ms 121152KB
23 AC 100% 182ms 122736KB
24 AC 100% 170ms 122464KB
25 AC 100% 147ms 125280KB
26 AC 100% 138ms 121920KB
27 AC 100% 152ms 120960KB
28 AC 100% 160ms 122928KB
29 AC 100% 183ms 123616KB
30 AC 100% 172ms 124144KB

ソースコード

import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	void solve(){
		int n=gInt(),h=gInt(),w=gInt();
		int[] c=new int[11];
		for(int i=0;i<h;++i)
			Arrays.stream(s.next().split("#"))
					.forEach(o->++c[o.length()]);
		
		for(int i=1;i<=n;++i) {
			int r=0;
			for(int j=1;j<=10;++j) {
				r+=j/i*c[j];
			}
			System.out.println(r);
		}
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return new Range(i);
	}
	Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int n){
		return REP(0,n-1);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}
}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
}