|
|
|
#define OLC_PGE_APPLICATION
|
|
|
|
#include "pixelGameEngine.h"
|
|
|
|
#include "olcutils.h"
|
|
|
|
|
|
|
|
using namespace olc;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
std::ifstream file("input");
|
|
|
|
int sum=0;
|
|
|
|
while (file.good()) {
|
|
|
|
std::string line;
|
|
|
|
std::getline(file,line);
|
|
|
|
int marker=0;
|
|
|
|
int prevmarker=0;
|
|
|
|
prevmarker=marker;marker=line.find_first_of('-');
|
|
|
|
int digit1=std::atoi(line.substr(0,marker).c_str());
|
|
|
|
prevmarker=marker;marker=line.find_first_of(',',marker);
|
|
|
|
int digit2=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str());
|
|
|
|
prevmarker=marker;marker=line.find_first_of('-',marker);
|
|
|
|
int digit3=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str());
|
|
|
|
prevmarker=marker;marker=line.find_first_of('\n',marker);
|
|
|
|
int digit4=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str());
|
|
|
|
|
|
|
|
//1-3 3-5 // 3-5 1-3
|
|
|
|
//1-4 4-7
|
|
|
|
//1-3 4-9
|
|
|
|
//4-6 5-9
|
|
|
|
//6-9 1-7 // 1-7 6-9
|
|
|
|
|
|
|
|
if (digit1<=digit4&&digit2>=digit3||digit2>=digit3&&digit1<=digit4) {
|
|
|
|
sum++;
|
|
|
|
std::cout<<line<<std::endl;
|
|
|
|
std::cout<<digit1<<","<<digit2<<","<<digit3<<","<<digit4<<std::endl;
|
|
|
|
std::cout<<"In Range"<<std::endl;
|
|
|
|
} else {
|
|
|
|
std::cout<<line<<std::endl;
|
|
|
|
std::cout<<digit1<<","<<digit2<<","<<digit3<<","<<digit4<<std::endl;
|
|
|
|
std::cout<<"NOT In Range"<<std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::cout<<"Sum: "<<sum<<std::endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|