結果
| 問題 |
No.1350 2019-6problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-17 14:19:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,725 bytes |
| コンパイル時間 | 1,699 ms |
| コンパイル使用メモリ | 177,028 KB |
| 実行使用メモリ | 916,900 KB |
| 最終ジャッジ日時 | 2024-11-29 15:40:06 |
| 合計ジャッジ時間 | 47,751 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 2 WA * 2 TLE * 4 MLE * 13 |
ソースコード
/*#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//fixed,setprecision
#include <limits.n>//INT_MAX
#include <math.n>//M_PI*/
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<int, int> P;
const ll INF = 3037000500;
//const int INF=INT_MAX;
//#define endl "\n"
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
int main(){
ll a,b,k;
cin>>a>>b>>k;
ll n=lcm(a,b);
map<ll,ll> x;
ll num=n/a+n/b-1;
ll amari=k%num;
ll bai=k/num;
for(int i=1;i<=amari;i++){
x[a*i]++;
x[b*i]++;
}
x[n]++;
//cout<<n<<" "<<x.size()<<" ";
ll cnt=0;
for(auto i=x.begin();i!=x.end();i++){
cnt++;
if(cnt==amari)cout<<i->first;
}
/*cout<<x.size();
for(auto p:x)cout<<p.first<<" ";*/
return 0;
}