题目描述
有若干个文件,使用刻录光盘的方式进行备份,假设每张光盘的容量是500MB,求使用光盘最少的文件分布方式
所有文件的大小都是整数的MB,且不超过500MB;文件不能分割、分卷打包
输入描述
一组文件大小的数据
输出描述
使用光盘的数量
用例
输入
100,500,300,200,400
输出
3
输入
1,100,200,300
输出
2
C++
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
bool check(int count, vector<int> nums);
bool partition(vector<int> buckets, vector<int> nums, int index);
int main() {
string input;
getline(cin, input);
stringstream ss(input);
string token;
vector<int>