結果

問題 No.415 ぴょん
ユーザー o.O~?
提出日時 2024-12-20 20:38:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 271 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 66,168 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-20 20:38:21
合計ジャッジ時間 4,080 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
int n,d,x,ans;
bool vis[2000001];
signed main(){
	cin>>n>>d;
	ans=0;
	vis[x=1]=true;
	while(1){
		x=(x+d)%n;
		x=x?x:n;
		if(vis[x])break;
		ans++,vis[x]=true;
	}
	cout<<ans;
}
0