Skip to content

Commit 4bde6ca

Browse files
authoredMay 16, 2019
Update F.Microtransactions.cpp
1 parent 6d2be38 commit 4bde6ca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎Round_560_Div3/F.Microtransactions/F.Microtransactions.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ bool isOK(int l, vector<int>&need, unordered_map<int,vector<int>>&daySale)
1414

1515
for (int i=l; i>=1; i--)
1616
{
17-
if (money>i) money--;
17+
money = min(money,i);
1818

1919
for (auto item: daySale[i])
2020
{
21-
int spend = min(money, need[item]-bought[item]);
22-
money -= spend;
23-
bought[item] += spend;
24-
spent += spend;
21+
int buy = min(money, need[item]-bought[item]);
22+
money -= buy;
23+
bought[item] += buy;
24+
spent += buy;
2525
}
2626
}
2727

0 commit comments

Comments
 (0)
Please sign in to comment.