fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int rank=0;
  6. int so_gio=0, tham_nien=0, thai_do=0, luong=0;
  7. int thuong_gio=0, thuong_tham_nien=0, thuong_thai_do=0;
  8. luong = 0;
  9.  
  10. cin >> rank;
  11. cin >> so_gio >> tham_nien >> thai_do;
  12.  
  13. if (rank == 1)
  14. {
  15. luong = 20000000;
  16. if (so_gio <= 160)
  17. {
  18. thuong_gio = 0;
  19. }
  20. else if (so_gio > 160)
  21. {
  22. thuong_gio = (so_gio - 160) * 200000;
  23. }
  24. }
  25. else if (rank == 2)
  26. {
  27. luong = 15000000;
  28. }
  29. else if (rank == 3)
  30. {
  31. luong = 5000000;
  32. }
  33. if ((rank == (1)) || (rank == (2)))
  34. {
  35. if (tham_nien < 1)
  36. {
  37. thuong_tham_nien = 0;
  38. }
  39. else if ((tham_nien >= 1) && (tham_nien <= 5))
  40. {
  41. thuong_tham_nien = 2000000;
  42. }
  43. else if (tham_nien > 5)
  44. {
  45. thuong_tham_nien = 5000000;
  46. }
  47. }
  48. else if (rank == 3)
  49. {
  50. thuong_tham_nien = 0;
  51. }
  52.  
  53. if ((thai_do <= 100) && (thai_do >= 90))
  54. {
  55. thuong_thai_do = luong/100 * 10;
  56. }
  57. else if ((thai_do <= 89) && (thai_do >= 70))
  58. {
  59. thuong_thai_do = luong / 100 * 5;
  60. }
  61. else
  62. {
  63. thuong_thai_do = 0;
  64. }
  65. cout << (luong + thuong_gio + thuong_thai_do + thuong_tham_nien);
  66. }
  67.  
Success #stdin #stdout 0.01s 5320KB
stdin
2
150 3 85
stdout
17750000