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.  
  10.  
  11. void fast()
  12. {
  13. ios_base::sync_with_stdio(0);
  14. cin.tie(0);
  15. cout.tie(0);
  16. }
  17.  
  18. //bool isPrime(int n) {
  19. // if (n <= 1) return false;
  20. // for (int i = 2; i * i <= n; i++)
  21. // if (n % i == 0) return false;
  22. // return true;
  23. //}
  24.  
  25. int main() {
  26.  
  27. fast();
  28. long long n, m, k;
  29. cin >> n >> m >> k;
  30.  
  31. int res = 0;
  32. int x = min(n, min(m, k));
  33. res += x;
  34. n -= x; m -= x; k -= x;
  35.  
  36. if (m != 0)
  37. cout << res;
  38.  
  39. else {
  40. if (k >= n/2 && n!=1) {
  41. res += (n / 2);
  42. cout << res;
  43. }
  44. else {
  45. res += k;
  46. cout << res;
  47. }
  48. }
  49.  
  50. return 0;
  51. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
348467648