Editorial for [Làm Quen OJ]. Bài 3. Print Expression
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
x, y, z, t có thể khai báo là int là đủ, tuy nhiên cần biết xử lý tràn khi tính toán (chú ý thứ 2 trong slide phần toán tử toán học)
Dòng 1 cần in ra theo đúng thứ tự đề bài yêu cầu chứ không phải in ra x, y, z, t
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
//n++ vs ++n
int main(){
int x, y, z, t;
cin >> x >> y >> z >> t;
cout << y << "," << z << "," << x << "," << t << endl;
cout << (long long)x + y + z + t << endl; // có thể lưu vào biến sau đó in ra cũng được
cout << x - y + (long long)z * t << endl; // có thể lưu vào biến sau đó in ra cũng được
return 0;
}
Comments