consolidate all repos to one for archive

This commit is contained in:
2025-01-28 13:46:42 +01:00
commit a6610fbc7a
5350 changed files with 2705721 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#include <iostream>
#include <fstream>
int main(int argc, char const *argv[])
{
std::ifstream inputFile(argv[1]);
int boxSize, goldSize, goldValue, silverSize, silverValue;
while (inputFile >> boxSize >> goldSize >> goldValue >> silverSize >> silverValue)
{
int maxValue = 0;
int goldCount = boxSize / goldSize;
int silverCount = boxSize / silverSize;
for (size_t i = 0; i <= goldCount; i++)
{
for (size_t j = 0; j <= silverCount; j++)
{
if (i * goldSize + j * silverSize <= boxSize)
{
int value = i * goldValue + j * silverValue;
maxValue = std::max(maxValue, value);
}
}
}
printf("%d\n", maxValue);
}
inputFile.close();
return 0;
}