結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2016-10-22 21:33:57 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 850 bytes |
コンパイル時間 | 4,080 ms |
コンパイル使用メモリ | 76,464 KB |
実行使用メモリ | 55,464 KB |
最終ジャッジ日時 | 2024-11-23 17:42:31 |
合計ジャッジ時間 | 8,232 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 5 WA * 6 RE * 11 |
ソースコード
import java.util.*; public class Exercise156 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int number = sc.nextInt(); for(int i = 0; i < number; i++){ System.out.println(calc(sc.nextLong())); } } public static String calc(Long num){ String numStr = String.valueOf(num); while(Long.parseLong(numStr) > 9){ char[] numArray = new char[numStr.length()]; for(int i = 0; i < numStr.length(); i++){ numArray[i] = numStr.charAt(i); } String str = ""; for(int i = 0; i < numStr.length() - 1; i++){ int x = Character.getNumericValue(numArray[i]) + Character.getNumericValue(numArray[i + 1]); if(x > 9){ x = x - 10 + 1; } str = str + String.valueOf(x); } numStr = str; } return numStr; } }