hdu1248

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int t, n;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		int x1 = n / 150, x2 = n / 200, x3 = n / 350;
		int ans = 10000;
		for (int i = 0; i <= x1; i++){
			for (int j = 0; j <= x2; j++){
				for (int k = 0; k <= x3; k++){
					if(i * 150 + j * 200 + k * 350 > n) continue;
					ans = min(ans, n - i * 150 - j * 200 - k * 350);
				}
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}
/**/

 

全部评论

相关推荐

10-30 22:18
已编辑
毛坦厂中学 C++
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务