fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int B;
  6. float A;
  7. cin >> A >> B;
  8. float X = A / B;
  9. int Y = X;
  10. if (X - Y == 0) {
  11.  
  12. cout << "floor " << A << " / " << B << " = " << Y<< endl;
  13. cout << "ceil " << A << " / " << B << " = " << Y << endl;
  14. cout << "round " << A << " / " << B << " = " << Y << endl;
  15. }
  16. else if (X - Y >= 0.5) {
  17.  
  18. cout << "floor " << A << " / " << B << " = " <<Y<< endl;
  19. cout << "ceil " << A << " / " << B << " = " << Y+1 << endl;
  20. cout << "round " << A << " / " << B << " = " << Y+1<< endl;
  21. }
  22. else if (X - Y < 0.5) {
  23.  
  24. cout << "floor " << A << " / " << B << " = " << Y << endl;
  25. cout << "ceil " << A << " / " << B << " = " <<Y+1 << endl;
  26. cout << "round "<< A << " / " << B << " = " << Y<< endl;
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
floor 3.06562e-41 / -1425336864 = 0
ceil 3.06562e-41 / -1425336864 = 0
round 3.06562e-41 / -1425336864 = 0