Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #ifdef LOCAL111
  2. #define _GLIBCXX_DEBUG
  3. #else
  4. #define NDEBUG
  5. #endif
  6. #include <bits/stdc++.h>
  7. const int INF = 1e9;
  8. using namespace std;
  9. template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }
  10.  
  11. #define endl '\n'
  12. #define ALL(a) (a).begin(),(a).end()
  13. #define SZ(a) int((a).size())
  14. #define FOR(i,a,b) for(int i=(a);i<(b);++i)
  15. #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
  16. #define REP(i,n) FOR(i,0,n)
  17. #define RREP(i,n) for (int i=(n)-1;i>=0;i--)
  18. #ifdef LOCAL111
  19. #define DEBUG(x) cout<<#x<<": "<<(x)<<endl
  20. template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
  21. #else
  22. #define DEBUG(x) true
  23. template<typename T> void dpite(T a, T b){ return; }
  24. #endif
  25. #define F first
  26. #define S second
  27. #define SNP string::npos
  28. #define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
  29. template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
  30. template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
  31. template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
  32.  
  33. typedef long long int LL;
  34. typedef unsigned long long ULL;
  35. typedef pair<int,int> P;
  36. typedef pair<LL,LL> LP;
  37.  
  38. void ios_init(){
  39. //cout.setf(ios::fixed);
  40. //cout.precision(12);
  41. #ifdef LOCAL111
  42. return;
  43. #endif
  44. ios::sync_with_stdio(false); cin.tie(0);
  45. }
  46.  
  47. int main()
  48. {
  49. ios_init();
  50. int a,b,c,d,e;
  51. cin >> a >> b >> c >> d >> e;
  52. if(b <= a){
  53. cout << 0 << endl;
  54. return 0;
  55. }
  56. int ans = 0;
  57. if(a <= 0){
  58. ans += min((-a)*c,(b-a)*c);
  59. ans += d;
  60. a = 0;
  61. }
  62. ans += e*(b-a);
  63. cout << ans << endl;
  64. return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement