fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int rank;
  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. }
  17. else if (rank == 2)
  18. {
  19. luong = 15000000;
  20. }
  21. else if (rank == 3)
  22. {
  23. luong = 5000000;
  24. }
  25.  
  26. if (rank == 1)
  27. {
  28. if (so_gio <= 160)
  29. {
  30. thuong_gio = 0;
  31. }
  32. else if (so_gio > 160)
  33. {
  34. thuong_gio = (so_gio - 160) * 200000;
  35. }
  36.  
  37. }
  38.  
  39.  
  40. if (rank == ((1) || rank == (2)))
  41. {
  42. if (tham_nien < 1)
  43. {
  44. thuong_tham_nien = 0;
  45. }
  46. else if ((tham_nien >= 1) && (tham_nien <= 5))
  47. {
  48. thuong_tham_nien = 2000000;
  49. }
  50. else if (tham_nien > 5)
  51. {
  52. thuong_tham_nien = 5000000;
  53. }
  54. }
  55. else if (rank == 3)
  56. {
  57. thuong_tham_nien = 0;
  58. }
  59.  
  60. if ((thai_do <= 100) && (thai_do >= 90))
  61. {
  62. thuong_thai_do = luong/100*10;
  63. }
  64. else if ((thai_do <= 89) && (thai_do >= 70))
  65. {
  66. thuong_thai_do = luong / 100 * 5;
  67. }
  68. else if (thai_do > 70)
  69. {
  70. thuong_thai_do = 0;
  71. }
  72. cout << luong + thuong_gio + thuong_thai_do + thuong_tham_nien;
  73.  
  74. return 0;
  75. }
  76.  
Success #stdin #stdout 0.01s 5284KB
stdin
2 
150 3 85
1
170 6 92
stdout
15750000