結果
問題 |
No.1350 2019-6problem
|
ユーザー |
![]() |
提出日時 | 2021-01-23 19:48:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 445 bytes |
コンパイル時間 | 2,116 ms |
コンパイル使用メモリ | 194,556 KB |
最終ジャッジ日時 | 2025-01-18 07:39:18 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 1 TLE * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) signed main(){ ll a,b,k; cin>>a>>b>>k; if(a==1||b==1){ cout<<k<<endl; return 0; } ll x=lcm(a,b); vector<ll>vec; for(int i=1;i<=x;i++){ if(i%a==0||i%b==0){ vec.push_back(i); } } ll s=vec.size(); if(s>=k){ cout<<vec[k-1]<<endl; return 0; } cout<<(k/s)*x+vec[k%s-1]<<endl; return 0; }