Cod sursa(job #904295)
Utilizator | Data | 4 martie 2013 02:19:21 | |
---|---|---|---|
Problema | A+B | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream in("adunare.in");
ofstream out("adunare.out");
int suma(int x, int y){
if (!y)
return x;
if ((x & y) == y)
return suma(y << 1, x ^ y);
return suma(x | y, x & y);
}
int main(){
int a, b;
in >> a >> b;
out << suma(a, b) << "\n";
return 0;
}