Day 1
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::string line;
|
||||
int total = 0;
|
||||
int max = 0;
|
||||
while(std::getline(std::cin, line))
|
||||
{
|
||||
if (0 == line.size())
|
||||
{
|
||||
if (total > max)
|
||||
{
|
||||
max = total;
|
||||
}
|
||||
total = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
total += stoi(line);
|
||||
}
|
||||
}
|
||||
std::cout << max << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user