Compare commits
No commits in common. "dcd83c8a2f2d1c88c1b00de1616e681b7fa96e03" and "96baccd2a4e8e56a3b23242c2f2d39c0b2af761b" have entirely different histories.
dcd83c8a2f
...
96baccd2a4
25
.vscode/launch.json
vendored
25
.vscode/launch.json
vendored
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [{
|
|
||||||
"name": "g++.exe - Build and debug active file",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${fileDirname}\\build\\${fileBasenameNoExtension}.exe",
|
|
||||||
"args": ["input/${fileBasenameNoExtension}.txt"],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"cwd": "${fileDirname}",
|
|
||||||
"environment": [],
|
|
||||||
"externalConsole": false,
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
|
|
||||||
"setupCommands": [{
|
|
||||||
"description": "Enable pretty-printing for gdb",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}],
|
|
||||||
"preLaunchTask": "C/C++: g++.exe build active file"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
27
.vscode/tasks.json
vendored
27
.vscode/tasks.json
vendored
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"tasks": [{
|
|
||||||
"type": "cppbuild",
|
|
||||||
"label": "C/C++: g++.exe build active file",
|
|
||||||
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
|
|
||||||
"args": [
|
|
||||||
"-fdiagnostics-color=always",
|
|
||||||
"-Wall",
|
|
||||||
"-g",
|
|
||||||
"${file}",
|
|
||||||
"-o",
|
|
||||||
"${fileDirname}\\build\\${fileBasenameNoExtension}.exe"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "${fileDirname}"
|
|
||||||
},
|
|
||||||
"problemMatcher": [
|
|
||||||
"$gcc"
|
|
||||||
],
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
},
|
|
||||||
"detail": "Task generated by Debugger."
|
|
||||||
}],
|
|
||||||
"version": "2.0.0"
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
if (argc <= 1) {
|
|
||||||
cerr << "No input file was given!" << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ifstream input;
|
|
||||||
input.open(argv[1]);
|
|
||||||
if (input.is_open()) {
|
|
||||||
vector<int> array;
|
|
||||||
int x, y, count;
|
|
||||||
while (input >> x) {
|
|
||||||
array.push_back(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
for (unsigned int i = 0; i < array.size() - 1; ++i) {
|
|
||||||
if (array[i + 1] > array[i]) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cout << count << endl;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
for (unsigned int i = 0; i < array.size() - 3; ++i) {
|
|
||||||
y = array[i] + array[i + 1] + array[i + 2];
|
|
||||||
x = array[i + 1] + array[i + 2] + array[i + 3];
|
|
||||||
if (x > y) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cout << count << endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cerr << "Unable to open file!";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
input.close();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
2000
2021/input/day01.txt
2000
2021/input/day01.txt
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user