标签:min inpu tle cep title 思路 问题 考试 ssi
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 38673 Accepted Submission(s): 15462
1 #include <bits/stdc++.h> 2 using namespace std; 3 double dp[10005]; 4 int w[10005]; 5 double v[10005]; 6 int main(){ 7 int n,m; 8 while(cin>>n>>m&&n+m){ 9 for(int i=0;i<=n;i++){ 10 dp[i]=1; 11 } 12 for(int i=1;i<=m;i++){ 13 cin>>w[i]>>v[i]; 14 } 15 for(int i=1;i<=m;i++){ 16 for(int j=n;j>=w[i];j--){ 17 dp[j]=min(dp[j],dp[j-w[i]]*(1-v[i])); 18 } 19 } 20 cout<<(1-dp[n])*100<<"%"<<endl; 21 } 22 return 0; 23 }
标签:min inpu tle cep title 思路 问题 考试 ssi
原文地址:https://www.cnblogs.com/esther6/p/10777110.html