結果
問題 |
No.176 2種類の切手
|
ユーザー |
![]() |
提出日時 | 2015-04-03 00:07:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,098 bytes |
コンパイル時間 | 695 ms |
コンパイル使用メモリ | 87,912 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 01:54:01 |
合計ジャッジ時間 | 2,379 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 3 |
ソースコード
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) int main(){ int A,B,T; cin >> A >> B >> T; int total = 0; int hoge; if(A<B){ hoge = A; A = B; B = hoge; } for(int i=ceil((double)T/(double)A);i>=0;i--){ if(T -total == 0) break; if(abs(T-total) > abs(T-(i*A+ B*ceil((double)(T-i*A)/(double)B)))){ total = (i*A+ B*ceil((T-i*A)/(double)B)); } } total = total == 0 ? B : total; cout << total << endl; return 0; }