fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N, P, Q, K, flatEntrance, flatFloor, entrance, floor;
  6. cin >> N >> P >> Q >> K;
  7. flatEntrance = N/P;
  8. flatFloor = N/P/Q;
  9. entrance = K/flatEntrance;
  10. if (K%flatEntrance != 0){
  11. entrance++;
  12. }
  13. if (K%flatEntrance == 0){
  14. floor = Q;
  15. } else {
  16. floor = (K%flatEntrance)/flatFloor;
  17. if (K%flatFloor != 0){
  18. floor++;
  19. }
  20. }
  21. cout << entrance << " " << floor << endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3460KB
stdin
90  3    15 90
stdout
3 15