比赛 |
20131130 |
评测结果 |
WWWWWWWWTT |
题目名称 |
提高速度 |
最终得分 |
0 |
用户昵称 |
Holiye |
运行时间 |
2.297 s |
代码语言 |
C++ |
内存使用 |
0.40 MiB |
提交时间 |
2015-09-19 22:23:12 |
显示代码纯文本
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <cmath>
- #include <algorithm>
- int z,l,n,c=1;
- double d;
- const int maxn=10000+2;
- struct node
- {
- int m,f;
- };
- node b[maxn];
- char a[maxn];
- int j=1,s;
- char ss();
- int max1;
- using namespace std;
- int main()
- {
- //freopen("test.in","r",stdin);
- //freopen("test.out","w",stdout);
- freopen("sboost.in","r",stdin);
- freopen("sboost.out","w",stdout);
-
- cin>>l>>z>>n;
- d=z*1.0/l;
- max1=d;
- for(int i=1;i<=n;i++)
- {
- j*=2;
- }
- for(int i=1;i<=n;i++)
- {
- a[i]='0';
- }
- for(int i=1;i<=n;i++)
- {
- cin>>b[i].f>>b[i].m;
- }
- ss();
- cout<<max1<<endl;
- return 0;
- }
- char ss()
- {
- for(int j=c;j<=n;j++)
- {
- a[j]='1';
- int h1=0,h2=0;
- for(int i=1;i<=n;i++)
- {
- if(a[i]=='1')
- {
- h1+=b[i].m;
- h2+=b[i].f;
- d=h1*1.0/h2;
- if(d>max1)
- max1=d;
- }
- }
- c++;
- ss();
- a[j]='0';
- }
- //if(c==n-1) return;
- }