Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
47682 hanxizhe 练60.1 丢失的数字 C++ 无测评数据 0 MS 0 KB 2445 2024-05-19 16:27:02

Tests(0/0):


#include<bits/stdc++.h> using namespace std; /*int m,n; int w[35],c[35],f[35]; void zeroonepack(int cost,int weight){ for(int v = m;v>=weight;v--){ f[v] = max(f[v],f[v-weight]+cost); } } int m,n; int w[35],c[35],f[35]; void completepack(int cost,int weight){ for(int v= weight;v<=m;v++){ f[v] = max(f[v],f[v-weight]+cost); } } int n,m; int w[505],c[505],num[505],f[6005]; void multipack(int cost,int weight,int num){ for(int v = m;v>=0;v--){ for(int k = 0;k<=num;k++){ if((v-k*weight)>=0){ f[v] = max(f[v],f[v-k*weight]+k*cost); } } } } int m,n; int w[35],c[35],num[35],f[205]; void zeroonepack(int cost,int weight){ for(int v = m;v>=weight;v--){ f[v] = max(f[v],f[v-weight]+cost); } } void completepack(int cost,int weight){ for(int v= weight;v<=m;v++){ f[v] = max(f[v],f[v-weight]+cost); } } void multipack(int cost,int weight,int num){ for(int v = m;v>=0;v--){ for(int k = 0;k<=num;k++){ if((v-k*weight)>=0){ f[v] = max(f[v],f[v-k*weight]+k*cost); } } } } int m,n,k; int a[1005],b[1005],c[1005],f[1005][1005]; void pack(int w1,int w2,int cost){ for(int j = m;j>=0;j--){ for(int k = n;k>=0;k--){ int u = j+w1; int v = k+w2; if(u>=m) u = m; if(v>=n) v = n; f[u][v] = min(f[u][v],f[j][k]+cost); } } }*/ int main(){ /*cin>>m>>n; for(int i = 1;i<=n;i++){ cin>>w[i]>>c[i]; } for(int i = 1;i<=n;i++){ zeroonepack(c[i],w[i]); } cout<<f[m]<<endl; cin>>m>>n; for(int i = 1;i<=n;i++){ cin>>w[i]>>c[i]; } for(int i = 1;i<=n;i++){ completepack(c[i],w[i]); } cout<<"max="<<f[m]<<endl; cin>>n>>m; for(int i = 1;i<=n;i++){ cin>>w[i]>>c[i]>>num[i]; } for(int i = 1;i<=n;i++){ multipack(c[i],w[i],num[i]); } cout<<f[m]<<endl; cin>>m>>n; for(int i = 1;i<=n;i++){ cin>>w[i]>>c[i]>>num[i]; } for(int i = 1;i<=n;i++){ if(num[i]==0) completepack(c[i],w[i]); else if(num[i]==1) zeroonepack(c[i],w[i]); else multipack(c[i],w[i],num[i]); } cout<<f[m]<<endl; cin>>m>>n>>k; for(int i = 1;i<=k;i++){ cin>>a[i]>>b[i]>>c[i]; } memset(f,9999999,sizeof(f)); f[0][0] = 0; for(int i = 1;i<=k;i++){ pack(a[i],b[i],c[i]); } cout<<f[m][n]<<endl;*/ int n,m,t,a[100001]; cin>>n>>m; for(int i = 0;i<m;++i){ cin>>t; a[t] = 1; } for(int i = 1;i<=n;++i){ if(a[i]==0){ cout<<i<<endl; } } return 0; }