https://www.acmicpc.net/problem/2438
#include <iostream>
using namespace std;
int main()
{
int index;
cin >> index;
for (int i = 0; i < index; i++)
{
for (int j = 0; j < i + 1; j++)
{
cout << "*";
}
cout << endl;
}
}
https://www.acmicpc.net/problem/2739
#include <iostream>
using namespace std;
int main()
{
int dan;
cin >> dan;
for (int i = 1; i <= 9; i++)
{
cout << dan << " * " << i << " = " << dan * i << endl;
}
cout << endl;
}
https://www.acmicpc.net/problem/2742
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = n; i > 0; i--) {
cout << i << "\n";
}
}
https://www.acmicpc.net/problem/2439
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int k = 1; k <= n - i; k++) {
cout << " ";
}
for (int j = 1; j < i + 1; j++)
{
cout << "*";
}
cout << "\n";
}
}
https://www.acmicpc.net/problem/2440
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = n; j > i; j--) {
cout << "*";
}
cout << "\n";
}
}
https://www.acmicpc.net/problem/2441
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = n; i > 0; i--) {
for (int k = n; k > i; k--) {
cout << " ";
}
for (int j = 0; j < i; j++) {
cout << "*";
}
cout << "\n";
}
}
https://www.acmicpc.net/problem/9498
#include <iostream>
using namespace std;
int main()
{
int score;
cin >> score;
if (score >= 90) {
cout << "A";
}
else if (score >= 80) {
cout << "B";
}
else if (score >= 70) {
cout << "C";
}
else if (score >= 60) {
cout << "D";
}
else
cout << "F";
}
https://www.acmicpc.net/problem/8393
#include <iostream>
using namespace std;
int main()
{
int n;
int sum = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
sum += i;
}
cout << sum;
}
https://www.acmicpc.net/problem/1924
#include <iostream>
using namespace std;
int main()
{
int month;
int day;
int daysOfMonth[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
string days[7] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
cin >> month >> day;
for (int i = 1; i < month; i++) {
day += daysOfMonth[i];
}
cout << days[day % 7];
}
https://www.acmicpc.net/problem/10871
#include <iostream>
using namespace std;
int main()
{
int n;
int x;
cin >> n >> x;
int sequence[10000] = {};
for (int i = 0; i < n; i++) {
cin >> sequence[i];
}
for (int i = 0; i < n; i++) {
if (sequence[i] < x) {
cout << sequence[i] << " ";
}
}
}
'C++ > 기초' 카테고리의 다른 글
백준으로 C++ 기초 문제 풀기 - 4 정렬(2) (0) | 2022.11.27 |
---|---|
백준으로 C++ 기초 문제 풀기 - 3 정렬(1) (0) | 2022.11.26 |
백준으로 C++ 기초 문제 풀기 - 2 (0) | 2022.11.25 |