結果
問題 |
No.141 魔法少女コバ
|
ユーザー |
![]() |
提出日時 | 2015-02-23 16:24:52 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 459 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 74,728 KB |
実行使用メモリ | 56,148 KB |
最終ジャッジ日時 | 2024-06-23 22:01:35 |
合計ジャッジ時間 | 16,602 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 56 RE * 37 |
ソースコード
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y=sc.nextInt(); int ans=0; while(x!=y){ if(x>y){ if(y==1){ int temp=x/y-1; x-=temp*y; ans+=temp; }else{ int temp=x/y; x-=temp*y; ans+=temp; } }else if(x<y){ int temp=x; x=y; y=temp; ans++; } } System.out.println(ans); } }