哭死了,为啥错了啊

#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;

struct _Pred{
_Pred(int &present, int &bank): present(present), bank(bank){}
bool operator()(int bud){
present += 300 - bud;
if(present < 0) return true;
bank += 100 * (present / 100);
present %= 100;
return false;
}
int &present, &bank;
};

int main(){
vector<int> budget;
int present = 0, bank = 0;

copy(istream_iterator<int>(cin), istream_iterator<int>(), back_inserter(budget));
vector<int>::iterator itr = find_if(budget.begin(), budget.end(), _Pred(present, bank));

if(itr == budget.end())
cout << bank * 1.2 + present << endl;
else
cout << budget.begin() - itr - 1 << endl;

return 0;
}

1 条评论

  • 1

信息

ID
1096
难度
5
分类
模拟 点击显示
标签
递交数
15996
已通过
5677
通过率
35%
被复制
38
上传者