結果
問題 |
No.176 2種類の切手
|
ユーザー |
![]() |
提出日時 | 2016-04-11 15:20:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 922 bytes |
コンパイル時間 | 661 ms |
コンパイル使用メモリ | 83,332 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 03:41:53 |
合計ジャッジ時間 | 1,719 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 4 |
ソースコード
/* -*- coding: utf-8 -*- * * 176.cc: No.176 2種類の切手 - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ typedef long long ll; const ll LINF = 1LL << 60; /* typedef */ typedef vector<int> vi; typedef queue<int> qi; typedef pair<int,int> pii; /* global variables */ /* subroutines */ /* main */ // a*x+b*y >= t // x >= (t-b*y)/a int main() { ll a, b, t; cin >> a >> b >> t; ll minsum = LINF; for (ll y = 0; b * y <= t && y <= a; y++) { ll x = (t - b * y + a - 1) / a; ll sum = a * x + b * y; if (minsum > sum) minsum = sum; } printf("%lld\n", minsum); return 0; }