結果

問題 No.432 占い(Easy)
ユーザー tsunabit
提出日時 2019-06-08 02:24:32
言語 Java
(openjdk 23)
結果
AC  
実行時間 557 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 76,444 KB
実行使用メモリ 52,624 KB
最終ジャッジ日時 2024-10-05 22:13:23
合計ジャッジ時間 10,780 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No432 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner s = new Scanner(System.in);
        int t = s.nextInt();
        for(int i = 0; i < t; i++) {
        	String str = s.next();
        	while(str.length() > 1) {
        		String[] v = new String[str.length()];
        		v = str.split("");
        		str = "";
        		for(int j = 0; j < v.length-1; j++) {
        			int temp = (Integer.parseInt(v[j]) + Integer.parseInt(v[j+1]));
        			if(temp >= 10) {
        				temp = (temp / 10) + (temp % 10);
        			}
        			str = str + temp;
        		}
        	}
        	System.out.println(str);
        }
    }
}
0