問題 L: 槍聲問題
#include <bits/stdc++.h>
#pragma
using namespace std;
int f(long long int a,long long int b){
while(b!=0){
int temp=a%b;
a=b;b=temp;
}
return a;
}
int main() {
long long int n,m,t,t1,t2,i,k,j,s,sum;
scanf("%lld",&s);
scanf("%lld",&t1);
scanf("%lld",&t2);
t1=t1+1;
t2=t2+1;
k=f(t1,t2);
t=t1/k*t2;
if(t1>t2)
{
long long int temp=t1;
t1=t2;t2=temp;
}
n=(s-1)*t1;
m=n/t;
sum=2*s-1-m;
printf("%d\n",sum);
return 0;
}