fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. long long N;
  8. if (!(cin >> N)) return 0;
  9.  
  10. double tien_truoc_thue = 0;
  11.  
  12. // Bậc 1: 0 - 100 kWh (Tối đa 100 kWh)
  13. if (N > 100) {
  14. tien_truoc_thue += 100 * 2000;
  15. N -= 100;
  16. } else {
  17. tien_truoc_thue += N * 2000;
  18. N = 0;
  19. }
  20.  
  21. // Bậc 2: 101 - 200 kWh (Tối đa 100 kWh)
  22. if (N > 100) {
  23. tien_truoc_thue += 100 * 2500;
  24. N -= 100;
  25. } else {
  26. tien_truoc_thue += N * 2500;
  27. N = 0;
  28. }
  29.  
  30. // Bậc 3: 201 - 400 kWh (Tối đa 200 kWh)
  31. if (N > 200) {
  32. tien_truoc_thue += 200 * 3000;
  33. N -= 200;
  34. } else {
  35. tien_truoc_thue += N * 3000;
  36. N = 0;
  37. }
  38.  
  39. // Bậc 4: 401 - 700 kWh (Tối đa 300 kWh)
  40. if (N > 300) {
  41. tien_truoc_thue += 300 * 3600;
  42. N -= 300;
  43. } else {
  44. tien_truoc_thue += N * 3600;
  45. N = 0;
  46. }
  47.  
  48. // Bậc 5: Từ 701 kWh trở lên
  49. if (N > 0) {
  50. tien_truoc_thue += N * 4000;
  51. }
  52.  
  53. // Cộng thêm 8% thuế VAT
  54. double tong_tien = tien_truoc_thue * 1.08;
  55.  
  56. // In kết quả, định dạng lấy 2 chữ số thập phân nếu đề bài yêu cầu số thực
  57. cout << fixed << setprecision(2) << tong_tien << endl;
  58.  
  59. return 0;
  60. }
  61.  
Success #stdin #stdout 0.01s 5324KB
stdin
850
stdout
2948400.00