結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2017-05-27 15:10:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 135 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 1,907 ms |
コンパイル使用メモリ | 79,308 KB |
実行使用メモリ | 54,352 KB |
最終ジャッジ日時 | 2024-07-06 19:11:38 |
合計ジャッジ時間 | 6,190 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
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]); } } } }