fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. long long a,b,c;
  9. int pol = 0;
  10. cin >> a >> b >> c;
  11. for(int i = 0;i < c;++i)
  12. {
  13. if(b*2+((pol*2)/10) > a)
  14. {
  15. if(a%2 == 1)
  16. {
  17. if(pol == 5)
  18. {
  19. b += (a/2)+1;
  20. pol = 0;
  21. }
  22. else
  23. {
  24. b += a/2;
  25. pol = 5;
  26. }
  27. cout << b << '.' << pol;
  28. return 0;
  29. }
  30. else
  31. {
  32. b += a/2;
  33. cout << b << '.' << pol;
  34. return 0;
  35. }
  36. }
  37. else
  38. {
  39. a -= b*2+((pol*2)/10);
  40. b *= 2;
  41. if(pol == 5)
  42. {
  43. b++;
  44. pol = 0;
  45. }
  46. }
  47. }
  48. cout << b << '.' << pol;
  49. }
Success #stdin #stdout 0s 5268KB
stdin
1000000000000000000 100000000000000000 1
stdout
200000000000000000.0