Pagini recente » Cod sursa (job #1540096) | Cod sursa (job #2715115) | Cod sursa (job #1084659) | Cod sursa (job #294337) | Cod sursa (job #2364634)
#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;
}