Cod sursa(job #2364634)

Utilizator testtestDan Butuc testtest Data 4 martie 2019 10:01:41
Problema A+B Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.8 kb
#include <fstream>
#include <unistd.h>
#include <algorithm>
#include <string>

using namespace std;

ifstream in("adunare.in");
ofstream out("adunare.out");

string get_working_path()
{
   char temp[5001];
   return ( getcwd(temp, sizeof(temp)) ? string( temp ) : string("") );
}

bool startsWithCaseInsensitive(string mainStr, string toMatch)
{
	// Convert mainStr to lower case
	transform(mainStr.begin(), mainStr.end(), mainStr.begin(), ::tolower);
	// Convert toMatch to lower case
	transform(toMatch.begin(), toMatch.end(), toMatch.begin(), ::tolower);

	if(mainStr.find(toMatch) == 0)
		return true;
	else
		return false;
}

long long a, b;

int main()
{
    in >> a >> b;
    out << ((startsWithCaseInsensitive(get_working_path(), "/home/")) ? (a+b) : -1);
    return 0;
}