結果
| 問題 |
No.1350 2019-6problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-17 14:04:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,825 bytes |
| コンパイル時間 | 1,643 ms |
| コンパイル使用メモリ | 173,204 KB |
| 実行使用メモリ | 1,080,136 KB |
| 最終ジャッジ日時 | 2024-11-29 15:19:04 |
| 合計ジャッジ時間 | 28,802 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 MLE * 1 |
| other | AC * 5 WA * 1 TLE * 3 MLE * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using vi = vector <int>;using vl = vector <long long>;
using vs = vector <string>;using vc = vector <char>;
using ll= long long;using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;using vd = vector <double>;
using vpl = vector <pair<ll,ll> >;using vb = vector<bool>;
#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 vin(a) rep(i,a.size())cin>>a[i]
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
#define all(n) n.begin(),n.end()
//各位の和
int wa(ll x){ll sum = 0;while(x!=0){sum += x% 10;x /= 10;}return sum;}
/*-----------順列生成-----------------
do {
} while (next_permutation(all(A)));*/
//最大公約数 ユークリッドの互除法
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}
//最小公倍数 a*b/gcd
ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
//コンビネーション nCk
ll C(ll n,ll k){ll p=1;rep(i,k)p=p*(n-i)/(i+1);return p;}
//'A'65,'a'97
/*小数点精度指定
cout<<fixed<<setprecision(9)<<;
*/
//priority_queue 優先度付きキュー
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;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
#define inf 1000000000000 //10^12:∞
#define mod 1000000007 //10^9+7:合同式の法
const double pi = acos(-1);
int main()
{
int a,b,k;cin>>a>>b>>k;
p=lcm(a,b);
q=p/a+p/b-1;
int ans=(k/q)*p;
k%=q;
double aa=a,bb=b;
vi v;
v.push_back(0);
Rep(i,1,k*(aa/(aa+bb))+10)v.push_back(a*i);
Rep(i,1,k*(bb/(aa+bb))+10)v.push_back(b*i);
sortp(v);
ans+=v[k];
print(ans);
}