记录编号 87867 评测结果 AAAAAAAAAA
题目名称 [NOIP 2004]津津的储蓄计划 最终得分 100
用户昵称 Gravatarnoier 是否通过 通过
代码语言 C++ 运行时间 0.010 s
提交时间 2014-02-11 14:39:57 内存使用 0.31 MiB
显示代码纯文本
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #pragma warning(disable:4996)
  5. using namespace std;
  6. int main()
  7. {
  8. freopen("save.in", "r", stdin);
  9. freopen("save.out", "w", stdout);
  10. int cost[13] = { 0 }, money[13][3] = { 0 }, cun = 0,hand;
  11. bool y = false;
  12. for (int i = 0; i < 12; i++) money[i][1] = 300;
  13. for (int i = 0; i < 12; i++) cin >> cost[i];
  14. for (int i = 0; i < 12; i++) money[i][0]=i+1;
  15. for (int i = 0; i < 12; i++)
  16. {
  17. hand=money[i][1];
  18. if (hand - cost[i] >= 300)
  19. {
  20. cun = cun + 300;
  21. hand = hand - 300 - cost[i];
  22. money[i + 1][1] = money[i + 1][1]+ hand;
  23. }
  24. else if (hand - cost[i] >= 200)
  25. {
  26. cun = cun + 200;
  27. hand = hand - 200 - cost[i];
  28. money[i + 1][1] = money[i + 1][1] + hand;
  29. }
  30. else if (hand - cost[i] >= 100)
  31. {
  32. cun = cun + 100;
  33. hand = hand - 100 - cost[i];
  34. money[i + 1][1] = money[i + 1][1] + hand;
  35. }
  36. else if (hand - cost[i] <0)
  37. {
  38. y = true;
  39. cout <<"-"<< money[i][0];
  40. break;
  41. }
  42. else money[i + 1][1] = money[i + 1][1] + hand-cost[i];
  43. }
  44. if (y == false) cout << cun*1.2+hand;
  45. return 0;
  46. }