結果

問題 No.141 魔法少女コバ
ユーザー kou6839
提出日時 2015-02-23 16:19:24
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,248 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 2,072 ms
コンパイル使用メモリ 77,280 KB
実行使用メモリ 54,464 KB
最終ジャッジ日時 2024-06-23 21:57:33
合計ジャッジ時間 21,819 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 93
権限があれば一括ダウンロードができます

ソースコード

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