1. (2577번) Hello World
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
2. (10718번) We love kriii
#include <iostream>
using namespace std;
int main()
{
std::cout << "강한친구 대한육군" << endl;
std::cout << "강한친구 대한육군" << endl;
return 0;
}
5. (1000번) A+B
#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << A + B;
return 0;
}
6. (1001번) A-B
#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << A - B;
return 0;
}
7. (10998번) A*B
#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << A * B;
return 0;
}
8. (1008번) A/B
#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout.precision(10);
cout << (double)A + B;
return 0;
}
9. (10869번) 사칙연산
#include <iostream>
using namespace std;
int main()
{
int A, B;
cout << A+B << endl;
cout << A-B << endl;
cout << A*B << endl;
cout << A/B << endl;
cout << A%B << endl;
return 0;
}
10. (10430번) 나머지
#include <iostream>
using namespace std;
int main()
{
int A, B, C;
cin >> A >> B >> C;
cout << (A+B)%C << endl;
cout << (A%C + B%C)%C << endl;
cout << (A*B%C) << endl;
cout << (A%C * B%C)%C << endl;
return 0;
}
11. (2588번) 곱셈
#include <iostream>
#include <string>
using namespace std;
int main()
{
int A;
string B;
cin >> A >> B;
cout << A*(B[2] - '0')<< endl;
cout << A*(B[1] -'0') << endl;
cout << A*(B[0] -'0') << endl;
cout << A * stoi(B) << endl;
return 0;
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
[C++][BOJ/백준][단계별로 풀어보기] 3. for문 (0) | 2021.05.28 |
---|---|
[C++][BOJ/백준][단계별로 풀어보기] 2. if문 (0) | 2021.05.28 |
[C++] 함수 (0) | 2021.04.27 |
[C++] 표현식과 문장 (0) | 2021.04.26 |
[C++] 연산자 (0) | 2021.04.24 |