提交时间:2026-04-22 21:25:42
运行 ID: 41434
#include<bits/stdc++.h> using namespace std; #define int long long int n,k; signed main(){ cin>>n>>k; if(!(n&1))return cout<<-1,0; int gcd=__gcd(n,k); if(gcd==1){ cout<<(n-1)/2<<endl; int cnt=n; int nw=1; while(cnt>1){ cout<<nw<<" "<<(nw+k)%n<<endl; cnt-=2; nw=(((nw+k)%n)+k)%n; } return 0; } else{ } return 0; }