結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2017-05-27 15:00:38 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 725 bytes |
コンパイル時間 | 1,860 ms |
コンパイル使用メモリ | 74,792 KB |
実行使用メモリ | 41,308 KB |
最終ジャッジ日時 | 2024-09-21 14:34:06 |
合計ジャッジ時間 | 5,768 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 6 |
ソースコード
import java.util.*; class test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String S1 = sc.next(); int def = 0; int sum = 0; int T = sc.nextInt(); String roma[] = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; for(int i=0; i<roma.length; i++){ if(S1.equals(roma[i])){ def = i+1; } } while(def >= 12){ def -= 12; } while(def <= -12){ def += 12; } while(T >= 12){ T -= 12; } while(T <= -12){ T += 12; } sum = def + T; while(sum >= 12){ sum -= 12; } while(sum < 0){ sum += 12; } for(int i=0; i<roma.length; i++){ if(sum == i+1){ System.out.println(roma[i]); } } } }