fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int V, A, B, C;
  6. if (!(cin >> V >> A >> B >> C)) return 0;
  7.  
  8. while (true) {
  9. // الأب (F)
  10. if (V - A < 0) {
  11. cout << "F" << endl;
  12. return 0;
  13. }
  14. V -= A;
  15.  
  16. // الأم (M)
  17. if (V - B < 0) {
  18. cout << "M" << endl;
  19. return 0;
  20. }
  21. V -= B;
  22.  
  23. // تاكاهاتشي (T)
  24. if (V - C < 0) {
  25. cout << "T" << endl;
  26. return 0;
  27. }
  28. V -= C;
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 5324KB
stdin
30 10 10 10 
stdout
F