Update 2021 sources to pass clang-tidy
This commit is contained in:
@@ -7,9 +7,9 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int main(void)
|
auto main() -> int
|
||||||
{
|
{
|
||||||
unsigned long prev{std::numeric_limits<unsigned long>::max()};
|
auto prev{std::numeric_limits<std::uint64_t>::max()};
|
||||||
unsigned incrs{0};
|
unsigned incrs{0};
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(std::cin, line)) {
|
while (std::getline(std::cin, line)) {
|
||||||
|
@@ -2,24 +2,25 @@
|
|||||||
// Created by Matthew Gretton-Dann on 01/12/2021.
|
// Created by Matthew Gretton-Dann on 01/12/2021.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int main(void)
|
auto main() -> int
|
||||||
{
|
{
|
||||||
std::vector<unsigned long> nums;
|
std::vector<std::uint64_t> nums;
|
||||||
unsigned incrs{0};
|
unsigned incrs{0};
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(std::cin, line)) {
|
while (std::getline(std::cin, line)) {
|
||||||
nums.push_back(std::stoul(line));
|
nums.push_back(std::stoul(line));
|
||||||
}
|
}
|
||||||
assert(nums.size() >= 3);
|
assert(nums.size() >= 3);
|
||||||
unsigned long prev{std::numeric_limits<unsigned long>::max()};
|
std::uint64_t prev{std::numeric_limits<std::uint64_t>::max()};
|
||||||
for (std::size_t pos = 0; pos <= nums.size() - 3; ++pos) {
|
for (std::size_t pos = 0; pos <= nums.size() - 3; ++pos) {
|
||||||
unsigned long current{0};
|
std::uint64_t current{0};
|
||||||
for (std::size_t i = pos + 0; i < pos + 3; ++i) {
|
for (std::size_t i = pos + 0; i < pos + 3; ++i) {
|
||||||
current += nums[i];
|
current += nums[i];
|
||||||
}
|
}
|
||||||
|
@@ -5,17 +5,17 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int main()
|
auto main() -> int
|
||||||
{
|
{
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
static const auto fwd{"forward "s};
|
static const auto fwd{"forward "s};
|
||||||
static const auto down{"down "s};
|
static const auto down{"down "s};
|
||||||
static const auto up{"up "s};
|
static const auto up{"up "s}; // NOLINT(readability-identifier-length)
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
unsigned long horiz{0};
|
std::uint64_t horiz{0};
|
||||||
unsigned long depth{0};
|
std::uint64_t depth{0};
|
||||||
while (std::getline(std::cin, line)) {
|
while (std::getline(std::cin, line)) {
|
||||||
if (line.size() > fwd.size() && line.substr(0, fwd.size()) == fwd) {
|
if (line.size() > fwd.size() && line.substr(0, fwd.size()) == fwd) {
|
||||||
horiz += std::stoul(line.substr(fwd.size()));
|
horiz += std::stoul(line.substr(fwd.size()));
|
||||||
|
@@ -5,18 +5,18 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int main()
|
auto main() -> int
|
||||||
{
|
{
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
static const auto fwd{"forward "s};
|
static const auto fwd{"forward "s};
|
||||||
static const auto down{"down "s};
|
static const auto down{"down "s};
|
||||||
static const auto up{"up "s};
|
static const auto up{"up "s}; // NOLINT(readability-identifier-length)
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
unsigned long horiz{0};
|
std::uint64_t horiz{0};
|
||||||
unsigned long depth{0};
|
std::uint64_t depth{0};
|
||||||
unsigned long aim{0};
|
std::uint64_t aim{0};
|
||||||
while (std::getline(std::cin, line)) {
|
while (std::getline(std::cin, line)) {
|
||||||
if (line.size() > fwd.size() && line.substr(0, fwd.size()) == fwd) {
|
if (line.size() > fwd.size() && line.substr(0, fwd.size()) == fwd) {
|
||||||
auto dist{std::stoul(line.substr(fwd.size()))};
|
auto dist{std::stoul(line.substr(fwd.size()))};
|
||||||
|
Reference in New Issue
Block a user