This repository has been archived on 2021-06-30. You can view files and clone it, but cannot push or open issues or pull requests.
aoc2020/day_1/main.cpp

26 lines
466 B
C++
Raw Normal View History

#include <iostream>
#include <fstream>
#include <vector>
int main() {
std::vector<int> vector;
std::ifstream input("../input.txt");
std::string line;
while(std::getline(input, line)) {
int num = std::stoi(line);
vector.push_back(num);
}
for (int i : vector) {
for (int j : vector) {
if (i + j == 2020) {
std::cout << (i * j) << std::endl;
}
}
}
return 0;
}