比赛 20131130 评测结果 WWWWWWWWTT
题目名称 提高速度 最终得分 0
用户昵称 Holiye 运行时间 2.297 s
代码语言 C++ 内存使用 0.40 MiB
提交时间 2015-09-19 22:23:12
显示代码纯文本
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <algorithm>
  6. int z,l,n,c=1;
  7. double d;
  8. const int maxn=10000+2;
  9. struct node
  10. {
  11. int m,f;
  12. };
  13. node b[maxn];
  14. char a[maxn];
  15. int j=1,s;
  16. char ss();
  17. int max1;
  18. using namespace std;
  19. int main()
  20. {
  21. //freopen("test.in","r",stdin);
  22. //freopen("test.out","w",stdout);
  23. freopen("sboost.in","r",stdin);
  24. freopen("sboost.out","w",stdout);
  25. cin>>l>>z>>n;
  26. d=z*1.0/l;
  27. max1=d;
  28. for(int i=1;i<=n;i++)
  29. {
  30. j*=2;
  31. }
  32. for(int i=1;i<=n;i++)
  33. {
  34. a[i]='0';
  35. }
  36. for(int i=1;i<=n;i++)
  37. {
  38. cin>>b[i].f>>b[i].m;
  39. }
  40. ss();
  41. cout<<max1<<endl;
  42. return 0;
  43. }
  44. char ss()
  45. {
  46. for(int j=c;j<=n;j++)
  47. {
  48. a[j]='1';
  49. int h1=0,h2=0;
  50. for(int i=1;i<=n;i++)
  51. {
  52. if(a[i]=='1')
  53. {
  54. h1+=b[i].m;
  55. h2+=b[i].f;
  56. d=h1*1.0/h2;
  57. if(d>max1)
  58. max1=d;
  59. }
  60. }
  61. c++;
  62. ss();
  63. a[j]='0';
  64. }
  65. //if(c==n-1) return;
  66. }