套用模板即可
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define mst(a,b) memset(a,b,sizeof(a))
const int maxn=1e4+5;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int money[5]={150,200,350};
int dp[maxn];
int main()
{
int t;
cin>>t;
while(t--)
{
mst(dp,0);
int n;
cin>>n;
for(int i=0;i<3;i++)
for(int j=money[i];j<=n;j++)
dp[j]=max(dp[j],dp[j-money[i]]+money[i]);
cout<<n-dp[n]<<endl;
}
return 0;
}