Ban đầu chúng ta khai báo a và b theo các kiểu dữ liệu.
B1:Nhập vào a và b : cin>>a>>b;
B2:Đưa ra kết quả của a + b với độ phức tạp O(1):cout << a + b;
Code c++ như sau:
#∈clude<bitsstdc++.h>usingnamespacestd;∫a,b;∫ma∈(){iosbase::syncwithstdio(false);c∈.tie(0);cout.tie(0);c∈〉a〉b;cout〈a+b;return0;}
# A + B
## Idea
In C++ we can read input values using std::c∈. After reading in A and B, we can print the sum to solve the problem in O(1).
## Code
#∈clude<bitsstdc++.h>usingnamespacestd;usingll=longlong;const∫MOD=1E9+7;const∫INF=1E9;constllINFLL=1E18;∫a;∫b;∫ma∈(){iosbase::syncwithstdio(false);c∈.tie(0);c∈〉a〉b;cout〈a+b〈\n;}