题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1203
题目解析:至少得到一份offer的概率计算:1-没被录取的概率:1-(1-a)*(1-b);
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<string>
#include<iostream>
#include<queue>
#include<stack>
#include<cstdlib>
using namespace std;
double dp[10005];
int main(void){
int n,m,ai,i,j;
double bi;
while(scanf("%d%d",&n,&m),n||m){
for(i=0;i<=n;i++)
dp[i]=0;
while(m--){
scanf("%d%lf",&ai,&bi);
for(i=n;i>=ai;i--)
dp[i]=max(dp[i],(1-(1-dp[i-ai])*(1-bi)));
}
printf("%.1lf%%\n",dp[n]*100);
}
return 0;
}