Cod sursa(job #1450253)
| Utilizator | Data | 12 iunie 2015 10:02:46 | |
|---|---|---|---|
| Problema | A+B | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
//ADUNARE PRIN BACKTRACKING
//MADE BY BIGFOOT
#include <fstream>
using namespace std;
ifstream f("adunare.in");
ofstream g("adunare.out");
long s1, s2, a, b;
bool v1, v2;
int main()
{
f >> a >> b;
s1 = s2 = 0;
while (v1 == false && v2 == false)
{
s1--;
if (s1 - a == b && s1 - b == a)
v1 = true;
s2++;
if (s2 - a == b && s2 - b == a)
v2 = true;
}
if (v1 == true)
g << s1;
else if (v2 == true)
g << s2;
}
