1A. Theatre Square solution


  1. #include
    <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. long double a, n, m, temp;
  8.  
  9. cout.precision(22);
  10. cin >> n >> m >>a;
  11. if(m < n)
  12. {
  13. temp = m;
  14. m = n;
  15. n = temp;
  16. }
  17.  
  18. if(a >= m)
  19. {
  20. cout << ceil(n/a) << endl;
  21. }
  22. else
  23. {
  24. cout << ceil(m/a)*ceil(n/a) << endl;
  25. }
  26. return 0;
  27. }

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution