結果
問題 | No.1350 2019-6problem |
ユーザー |
![]() |
提出日時 | 2021-01-17 13:14:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,294 bytes |
コンパイル時間 | 823 ms |
コンパイル使用メモリ | 85,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 13:44:55 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <algorithm>#include <cfloat>#include <climits>#include <cmath>#include <complex>#include <cstdio>#include <cstdlib>#include <cstring>#include <functional>#include <iostream>#include <map>#include <memory>#include <queue>#include <deque>#include <set>#include <sstream>#include <stack>#include <string>#include <utility>#include <vector>#include <cassert>#include <iostream>#include <stdio.h>#include <time.h>using namespace std;typedef long long ll;#define sz size()#define pb push_back#define mp make_pair#define fi first#define se second#define all(c) (c).begin(), (c).end()#define rep(i,a,b) for(ll i=(a);i<(b);++i)#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)#define clr(a, b) memset((a), (b) ,sizeof(a))#define ctos(c) string(1,c)#define MOD 1000000007long long gcd(long long a, long long b){return b == 0LL ? a : gcd(b, a % b);}long long lcm(long long a, long long b){return a / gcd(a, b) * b;}int main(){ll a,b,k;cin>>a>>b>>k;long long low = 0;long long high = 1000000000000000000LL;ll g = lcm(a,b);while(low < high){long long mid = (high + low) >> 1;ll c = mid/a+mid/b-mid/g;if(c >= k){high = mid;}else{low = mid + 1;}}cout << low << endl;return 0;}