fork download
  1. #include<iostream>
  2. #include<math.h>
  3. #include<iomanip>
  4. #include <string>
  5. #include<algorithm>
  6. #include <vector>
  7. using namespace std;
  8.  
  9. void fast()
  10. {
  11. ios_base::sync_with_stdio(0);
  12. cin.tie(0);
  13. cout.tie(0);
  14. }
  15.  
  16. //bool isPrime(int n) {
  17. // if (n <= 1) return false;
  18. // for (int i = 2; i * i <= n; i++)
  19. // if (n % i == 0) return false;
  20. // return true;
  21. //}
  22.  
  23. int main() {
  24.  
  25. fast();
  26. long long n, m, k;
  27. cin >> n >> m >> k;
  28.  
  29. int res = 0;
  30. int x = min(n, min(m, k));
  31. res += x;
  32. n -= x; m -= x; k -= x;
  33.  
  34. if (m != 0)
  35. cout << res;
  36.  
  37. else {
  38. if (k >= n/2 && n!=1) {
  39. res += (n / 2);
  40. cout << res;
  41. }
  42. else {
  43. res += k;
  44. cout << res;
  45. }
  46. }
  47.  
  48. return 0;
  49. }
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
-1404480