結果

問題 No.1350 2019-6problem
ユーザー sushitorunasushitoruna
提出日時 2021-05-19 20:45:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 3,504 ms
コンパイル使用メモリ 225,272 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 09:10:00
合計ジャッジ時間 4,283 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;using namespace atcoder;
using ll=long long;using vl=vector<ll>;
using vi=vector<int>;using vs=vector<string>;using vc=vector<char>;
using vvl=vector<vl>;using pl=pair<ll,ll>;using vvc=vector<vc>;
using vd=vector<double>;using vpl=vector<pl>;using vb=vector<bool>;
#define fi first
#define se second
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<(n)<<endl
#define all(a)  (a).begin(),(a).end()
#define sortp(d) sort(all(d))
#define sortm(d) sort(d.rbegin(),d.rend())
//cout<<fixed<<setprecision(15)<<
//priority_queue<pl,vpl,greater<pl>>
void yn(bool b){print(b?"Yes":"No");exit(0);}
ll gcd(ll a,ll b) {if(b==0)return a;else return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll modpow(ll a,ll n,ll mod) {ll res=1;while(n>0)
{if(n&1)res=res*a%mod;a=a*a%mod;n >>= 1;}return res;}
ll modinv(ll a,ll mod){return modpow(a, mod - 2, mod);}
ll p=0,q=0,r=0,inf=100000000000000,mod=1000000007;
ll dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
//ここから本質←ほんまか?
int main()
{
  ll a,b,k;
  cin>>a>>b>>k;
  ll ok=a*k,ng=0;
  while(abs(ok-ng)>1)
  {
    ll mid=(ok+ng)/2;
    if(mid/a+mid/b-mid/lcm(a,b)<k)ng=mid;
    else ok=mid;
  }
  print(ok);
}
0