Cod sursa(job #1194393)
Utilizator | Data | 3 iunie 2014 19:23:22 | |
---|---|---|---|
Problema | A+B | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
using namespace std;
const int INF = 2000000000;
int main(){
int a,b;
ifstream f("adunare.in");
f >> a >> b;
int l = -INF;
int r = INF;
int sol;
while(l<=r){
int m = (l+r)/2;
if(m==a+b){
sol = m;
break;
}
else
if(m < a+b)
l = m+1;
else
r = m-1;
}
ofstream g("adunare.out");
g<<sol<<"\n";
return 0;
}