結果

問題 No.176 2種類の切手
ユーザー koyumeishikoyumeishi
提出日時 2015-04-02 23:42:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 78,216 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 21:24:19
合計ジャッジ時間 1,551 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0