Advertisement
IlidanBabyRage

casting.cpp

Jul 8th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8.    
  9.     int n, a, b, c, mm;
  10.     cin >> mm >> n >> a >> b >> c;
  11.     if (a > b)
  12.         swap(a, b);
  13.     if (b > c)
  14.         swap(b, c);
  15.     if (a > b)
  16.         swap(a, b);
  17.     if (mm == 2)
  18.         cout << a << endl;
  19.     else
  20.         cout << ((a + b - n) > 0 ? (a + b - n) : 0) << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement