結果

問題 No.141 魔法少女コバ
ユーザー kou6839
提出日時 2015-02-23 16:22:28
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 377 bytes
コンパイル時間 2,650 ms
コンパイル使用メモリ 74,420 KB
実行使用メモリ 61,108 KB
最終ジャッジ日時 2024-06-23 21:58:15
合計ジャッジ時間 9,670 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 TLE * 1 -- * 89
権限があれば一括ダウンロードができます

ソースコード

diff #

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){
				int temp=x/y-1;
				x-=temp*y;
				ans+=temp;
			}else if(x<y){
				int temp=x;
				x=y;
				y=temp;
				ans++;
			}
		}
		System.out.println(ans);
	}
}
0