#include<iostream> #include<utility> #include<vector> #include<algorithm> int main() { using namespace std; for (int n; cin >> n;) { vector<pair<int, int>> vec; for (int k =9, i{1}, j;k > 0 && cin >> j;--k,++i) { vec.push_back({ i,j }); } int minx = vec[0].second; for (const auto& p : vec) { minx = minx > p.second ? p.second : minx; } for (int bit = n / minx;bit > 0;--bit) { auto iter = find_if(vec.rbegin(), vec.rend(), [n, bit, minx](pair<int, int> big) {return big.second <= n - (bit-1)*minx;}); n -= iter->second; cout << iter->first; } cout << '\n'; } }
点赞 2

相关推荐

11-08 17:36
诺瓦科技_HR
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
10-15 14:22
点赞 评论 收藏
分享
牛客网
牛客企业服务