結果

問題 No.176 2種類の切手
ユーザー ry0u_yd
提出日時 2015-04-03 00:03:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 60,452 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 01:52:29
合計ジャッジ時間 3,507 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int a,b,t;
	cin >> a >> b >> t;

	if(a < b) swap(a,b);

	int d = a-b;
	int res = 0;
	while(res < t)
	{
		if(res + a <= t) res += a;
		else res += b;
	}

	bool flag = true;
	while(flag)
	{
		if(res - d >= t) res -= d;
		else flag = false;
	}

	cout << res << endl;



	return 0;
}
0