結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-04-02 23:42:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 747 ms |
| コンパイル使用メモリ | 78,160 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 01:36:11 |
| 合計ジャッジ時間 | 1,685 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 8 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;
int main(){
long long A,B,T;
cin >> A >> B >> T;
long long lb = ( T/(A+B) ) * (A+B);
long long ub = (T/(A+B) +1) * (A+B);
vector<long long> v;
if(T <= lb) v.push_back(lb);
v.push_back(ub);
long long rem = T - lb;
{
long long x = lb + rem/A * A;
long long y = lb + (rem/A+1) * A;
if(T <= x) v.push_back(x);
v.push_back(y);
}
{
long long x = lb + rem/B * B;
long long y = lb + (rem/B+1) * B;
if(T <= x) v.push_back(x);
v.push_back(y);
}
sort(v.begin(), v.end());
/*
for(int i=0; i<v.size(); i++){
cerr << v[i] << endl;
}
*/
cout << v[0] << endl;
return 0;
}
koyumeishi