結果

問題 No.141 魔法少女コバ
コンテスト
ユーザー kotatsugame
提出日時 2026-02-06 23:20:19
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 250 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 746 ms
コンパイル使用メモリ 74,020 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-06 23:20:23
合計ジャッジ時間 4,235 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 93
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<cassert>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N,M;cin>>N>>M;
	int ans=-1;
	while(true)
	{
		ans+=N/M;
		N%=M;
		if(N==0)break;
		swap(N,M);
		ans++;
	}
	cout<<ans<<endl;
}
0