結果

問題 No.141 魔法少女コバ
ユーザー kuuso1kuuso1
提出日時 2015-02-02 00:26:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,111 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 107,724 KB
実行使用メモリ 22,972 KB
最終ジャッジ日時 2023-09-05 10:14:43
合計ジャッジ時間 10,676 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
18,896 KB
testcase_01 AC 57 ms
20,812 KB
testcase_02 AC 58 ms
20,824 KB
testcase_03 AC 58 ms
22,888 KB
testcase_04 AC 57 ms
20,816 KB
testcase_05 AC 57 ms
20,740 KB
testcase_06 AC 58 ms
20,872 KB
testcase_07 AC 56 ms
18,816 KB
testcase_08 AC 59 ms
20,824 KB
testcase_09 AC 58 ms
20,804 KB
testcase_10 AC 57 ms
20,712 KB
testcase_11 AC 58 ms
20,868 KB
testcase_12 AC 58 ms
20,944 KB
testcase_13 AC 57 ms
20,864 KB
testcase_14 AC 58 ms
20,788 KB
testcase_15 AC 58 ms
20,752 KB
testcase_16 AC 59 ms
20,744 KB
testcase_17 AC 58 ms
22,700 KB
testcase_18 AC 59 ms
20,936 KB
testcase_19 AC 59 ms
20,828 KB
testcase_20 AC 58 ms
20,836 KB
testcase_21 AC 59 ms
22,704 KB
testcase_22 AC 58 ms
20,680 KB
testcase_23 AC 58 ms
20,856 KB
testcase_24 AC 57 ms
20,908 KB
testcase_25 AC 57 ms
20,868 KB
testcase_26 AC 57 ms
22,768 KB
testcase_27 AC 57 ms
20,756 KB
testcase_28 AC 57 ms
20,924 KB
testcase_29 AC 57 ms
20,680 KB
testcase_30 AC 59 ms
20,808 KB
testcase_31 AC 57 ms
22,840 KB
testcase_32 AC 57 ms
22,920 KB
testcase_33 AC 57 ms
20,796 KB
testcase_34 AC 57 ms
22,716 KB
testcase_35 AC 58 ms
20,784 KB
testcase_36 AC 57 ms
22,760 KB
testcase_37 AC 57 ms
20,812 KB
testcase_38 AC 57 ms
22,760 KB
testcase_39 AC 57 ms
20,716 KB
testcase_40 AC 57 ms
20,844 KB
testcase_41 AC 56 ms
20,724 KB
testcase_42 AC 56 ms
20,884 KB
testcase_43 AC 57 ms
20,788 KB
testcase_44 AC 57 ms
20,712 KB
testcase_45 AC 57 ms
20,808 KB
testcase_46 AC 56 ms
20,748 KB
testcase_47 AC 57 ms
22,908 KB
testcase_48 AC 58 ms
20,824 KB
testcase_49 AC 58 ms
20,740 KB
testcase_50 AC 57 ms
22,848 KB
testcase_51 AC 57 ms
18,660 KB
testcase_52 AC 58 ms
22,812 KB
testcase_53 AC 57 ms
18,860 KB
testcase_54 AC 59 ms
20,860 KB
testcase_55 AC 58 ms
22,864 KB
testcase_56 AC 59 ms
20,860 KB
testcase_57 AC 58 ms
20,848 KB
testcase_58 AC 57 ms
20,776 KB
testcase_59 AC 58 ms
22,848 KB
testcase_60 AC 58 ms
20,840 KB
testcase_61 AC 58 ms
20,712 KB
testcase_62 AC 58 ms
20,676 KB
testcase_63 AC 58 ms
20,744 KB
testcase_64 AC 58 ms
20,796 KB
testcase_65 AC 60 ms
20,808 KB
testcase_66 AC 58 ms
20,732 KB
testcase_67 AC 60 ms
20,800 KB
testcase_68 AC 58 ms
22,852 KB
testcase_69 AC 58 ms
20,864 KB
testcase_70 AC 58 ms
20,876 KB
testcase_71 AC 58 ms
18,668 KB
testcase_72 AC 60 ms
20,824 KB
testcase_73 AC 58 ms
18,872 KB
testcase_74 AC 59 ms
20,888 KB
testcase_75 AC 59 ms
20,740 KB
testcase_76 AC 58 ms
22,896 KB
testcase_77 AC 58 ms
20,816 KB
testcase_78 AC 58 ms
20,852 KB
testcase_79 AC 58 ms
22,972 KB
testcase_80 AC 58 ms
22,860 KB
testcase_81 AC 58 ms
20,640 KB
testcase_82 AC 58 ms
20,672 KB
testcase-evil-0.txt AC 57 ms
20,732 KB
testcase-evil-1.txt AC 59 ms
22,892 KB
testcase-evil-2.txt AC 57 ms
20,832 KB
testcase-evil-3.txt AC 59 ms
22,772 KB
testcase-evil-4.txt AC 58 ms
22,968 KB
testcase-evil-5.txt AC 57 ms
20,924 KB
testcase-evil-6.txt AC 59 ms
20,780 KB
testcase-evil-7.txt AC 58 ms
20,916 KB
testcase-evil-8.txt AC 57 ms
20,824 KB
testcase-evil-9.txt AC 58 ms
22,720 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long g=gcd(N,M);
		M/=g;N/=g;
		
		long cnt=0;
		while(M!=0){
			if(M>=N){
				cnt+=(M/N);
				M%=N;
				continue;
			}else{
				cnt++;
				long tmp=M;M=N;N=tmp;
			}
		}
		Console.WriteLine(cnt-1);
	}
	
	
	public static long gcd(long a,long b){
		return a==0?b:gcd(b%a,a);
	}
	
	long N,M;
	public Sol(){
		var d=rla();
		M=d[0];N=d[1];
	}
	
	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0