結果

問題 No.432 占い(Easy)
ユーザー kohaku_kohaku
提出日時 2016-11-16 02:32:59
言語 Java
(openjdk 23)
結果
AC  
実行時間 571 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 76,280 KB
実行使用メモリ 50,936 KB
最終ジャッジ日時 2024-11-26 02:02:09
合計ジャッジ時間 10,091 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for(int i=0; i<N; i++){
            String S = sc.next();
            while( S.length()!=1 ){
                String [] arr = S.split("");
                S="";
                for(int j=1; j<arr.length; j++){
                    int r = Integer.parseInt(arr[j-1]) + Integer.parseInt(arr[j]);
                    if(r>=10){
                        r=r/10+r%10;
                    }
                    S=S+r;
                }
            }
            System.out.println(S);
        }
    }
}
0