Processing math: 100%
Solutions of A + B - MarisaOJ: Marisa Online Judge

Solutions of A + B

Select solution language

Write solution here.


User Avatar phphongyd    Created at    28 likes

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);cab;couta+b;return0;}

omegumunot    Created at    7 likes

# 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;constMOD=1E9+7;constINF=1E9;constllINFLL=1E18;a;b;ma(){iosbase::syncwithstdio(false);c.tie(0);cab;couta+b\n;}

orz_qbl    Created at    3 likes

# Dùng python (phức tạp) Code này yêu cầu 1 dòng 2 giá trị của a và b nên ta phải dùng map(). pya,b=map(,put().split())pr(a+b)