Add .clang-format and apply it

This commit is contained in:
2021-12-02 07:18:16 +00:00
parent e58dede1b6
commit cd5e2538df
103 changed files with 2714 additions and 2132 deletions

View File

@@ -11,7 +11,8 @@
using Distance = unsigned long;
Distance distance(std::string const &s, unsigned t) {
Distance distance(std::string const& s, unsigned t)
{
static const std::regex re("(\\w+) can fly (\\d+) km/s for (\\d+) seconds?, "
"but then must rest for (\\d+) seconds?.");
std::smatch m;
@@ -32,15 +33,17 @@ Distance distance(std::string const &s, unsigned t) {
t = std::min(t, fly_time);
result += t * fly_speed;
std::cout << m.str(1) << "(" << fly_speed << ", " << fly_time << ", "
<< rest_time << ") = " << result << "\n";
std::cout << m.str(1) << "(" << fly_speed << ", " << fly_time << ", " << rest_time
<< ") = " << result << "\n";
return result;
} else {
}
else {
assert(false);
}
}
int main(int argc, char **argv) {
int main(int argc, char** argv)
{
Distance max_d = 0;
for (std::string line; std::getline(std::cin, line);) {
max_d = std::max(max_d, distance(line, 2503));