結果

問題 No.661 ハローキティはりんご3個分
ユーザー fal_rndfal_rnd
提出日時 2018-03-13 10:32:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 4,206 bytes
コンパイル時間 2,789 ms
コンパイル使用メモリ 83,844 KB
実行使用メモリ 50,616 KB
最終ジャッジ日時 2024-11-21 11:00:31
合計ジャッジ時間 3,607 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
50,400 KB
testcase_01 AC 63 ms
50,496 KB
testcase_02 AC 62 ms
50,160 KB
testcase_03 AC 62 ms
50,616 KB
testcase_04 AC 57 ms
50,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

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

	void solve(){
		for(int i:ints(gInt())) {
			String v="";
			if(i%8==0)
				v+="iki";
			if(i%10==0)
				v+="sugi";
			if(v.equals(""))
				v=""+i/3;
			System.out.println(v);
		}
	}

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

	int gInt(){
		return s.nextInt();
	}
	long gLong(){
		return s.nextLong();
	}
	double gDouble(){
		return Double.parseDouble(s.next());
	}

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

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(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 INTS(int n){
		return IntStream.generate(this::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}

class FastScanner{
	private final BufferedInputStream	in;
	private static final int			bufSize	=1<<16;
	private final byte					buf[]	=new byte[bufSize];
	private int							i		=bufSize,k=bufSize;
	private final StringBuilder			str		=new StringBuilder();

	FastScanner(InputStream in){
		this.in=new BufferedInputStream(in,bufSize);
	}
	int nextInt(){
		return (int)nextLong();
	}
	long nextLong(){
		int c;
		long x=0;
		boolean sign=true;
		while((c=nextChar())<=32)
			;
		if(c=='-'){
			sign=false;
			c=nextChar();
		}
		if(c=='+'){
			c=nextChar();
		}
		while(c>='0'){
			x=x*10+(c-'0');
			c=nextChar();
		}
		return sign?x:-x;
	}
	private int nextChar(){
		if(i==k){
			try{
				k=in.read(buf,i=0,bufSize);
			}catch(IOException e){
				System.exit(-1);
			}
		}
		return i>=k?-1:buf[i++];
	}
	String next(){
		int c;
		str.setLength(0);
		while((c=nextChar())<=32&&c!=-1)
			;
		if(c==-1)
			return null;
		while(c>32){
			str.append((char)c);
			c=nextChar();
		}
		return str.toString();
	}
	String nextLine(){
		int c;
		str.setLength(0);
		while((c=nextChar())<=32&&c!=-1)
			;
		if(c==-1)
			return null;
		while(c!='\n'){
			str.append((char)c);
			c=nextChar();
		}
		return str.toString();
	}

}

class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	private int	remain;
	Supplier<T>	supplier;

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

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

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

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

}

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

	Range(int from,int to,int d){
		this.from=from;
		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;
	}

	protected final int CHARACTERISTICS=Spliterator.SIZED|Spliterator.DISTINCT|Spliterator.IMMUTABLE|Spliterator.NONNULL;
	@Override
	public Spliterator.OfInt spliterator(){
		return Spliterators.spliterator(this,(to-from)/d+1,CHARACTERISTICS);
	}

	IntStream stream(){
		return d==1?IntStream.rangeClosed(from,to):java.util.stream.StreamSupport.intStream(this.spliterator(),false);
	}


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


}
0