반응형 문제 해결238 [백준] [C++] 10699번 오늘 날짜 https://www.acmicpc.net/problem/10699 10699번: 오늘 날짜 서울의 오늘 날짜를 출력하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include #include int main() { time_t timer = time(NULL); struct tm* t = localtime(&timer); printf("%d-%d-%d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); return 0; } 풀이 오늘 날짜를 출력하는 문제이다. c++에서 time과 관련된 함수는 #include 을 통해 사용할 수 있다. time 함수를 사용하여 time_t 자료 형태로 현재 시간 결과를 반환한다. 이때 현재 시간은 1970년 1월 .. 2022. 11. 16. [백준] [C++] 10093번 숫자 https://www.acmicpc.net/problem/10093 10093번: 숫자 두 양의 정수가 주어졌을 때, 두 수 사이에 있는 정수를 모두 출력하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include #include using namespace std; int main() { long long a, b; cin >> a >> b; if (a > b) { swap(a, b); } if (a == b) { cout 2022. 11. 14. [백준] [C++] 9713번 Sum of Odd Sequence https://www.acmicpc.net/problem/9713 9713번: Sum of Odd Sequence First line of the input contains T, the number of test cases. Each test case contains a single integer N. N is between 1 and 100. www.acmicpc.net 코드 #include using namespace std; int main() { int n, a; cin >> n; for (int i = 0; i > a; int sum = 0; for (int j = 1; j 2022. 11. 14. [백준] [C++] 9654번 나부 함대 데이터 https://www.acmicpc.net/problem/9654 9654번: 나부 함대 데이터 나부 행성의 함대의 정보를 아래와 예제 출력과 같은 표로 출력한다. 처음 두 열의 너비는 문자 15개, 세 번째 열은 11개, 마지막 열의 너비는 10개이다. www.acmicpc.net 코드 #include using namespace std; int main() { cout 2022. 11. 14. [백준] [C++] 9316번 Hello Judge https://www.acmicpc.net/problem/9316 9316번: Hello Judge 한 줄에 하나의 Hello World, Judge i! 를 출력한다. www.acmicpc.net 코드 #include using namespace std; int main() { int n; cin >> n; for (int i = 1; i 2022. 11. 14. [백준] [C++] 8393번 합 https://www.acmicpc.net/problem/8393 8393번: 합 n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. www.acmicpc.net 코드 #include using namespace std; int main() { int n, sum = 0; cin >> n; for (int i = 1; i 2022. 11. 14. [백준] [C++] 8370번 Plane https://www.acmicpc.net/problem/8370 8370번: Plane In the first and only line of the standard input there are four integers n1, k1, n2 and k2 (1 ≤ n1, k1, n2, k2 ≤ 1 000), separated by single spaces. www.acmicpc.net 코드 #include using namespace std; int main() { int n1, n2, k1, k2; cin >> n1 >> n2 >> k1 >> k2; cout 2022. 11. 14. [백준] [C++] 7891번 Can you add this? https://www.acmicpc.net/problem/7891 7891번: Can you add this? The input contains several test cases. The first line contains and integer t (t ≤ 100) denoting the number of test cases. Then t tests follow, each of them consisiting of two space separated integers x and y (−109 ≤ x, y ≤ 109). www.acmicpc.net 코드 #include using namespace std; int main() { int n, a, b; cin >> n; for (int i = 0; i < n;.. 2022. 11. 14. [백준] [C++] 6810번 ISBN https://www.acmicpc.net/problem/6810 6810번: ISBN The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was written correctly. The 1-3-sum of a 13-digit number is calculated by multiplying the digits a www.acmicpc.net 코드 #include using namespace std; int main() { int a[3], sum = 91; for (int i.. 2022. 11. 14. [백준] [C++] 6778번 Which Alien? https://www.acmicpc.net/problem/6778 6778번: Which Alien? Canada Cosmos Control has received a report of another incident. They believe that an alien has illegally entered our space. A person who witnessed the appearance of the alien has come forward to describe the alien’s appearance. It is your role within th www.acmicpc.net 코드 #include using namespace std; int main() { int a, b; cin >> a; cin .. 2022. 11. 13. [백준] [C++] 6749번 Next in line https://www.acmicpc.net/problem/6749 6749번: Next in line You know a family with three children. Their ages form an arithmetic sequence: the difference in ages between the middle child and youngest child is the same as the difference in ages between the oldest child and the middle child. For example, their ages c www.acmicpc.net 코드 #include using namespace std; int main() { int a, b, c; cin >> a;.. 2022. 11. 13. [백준] [C++] 5522번 카드 게임 https://www.acmicpc.net/problem/5522 5522번: 카드 게임 JOI군은 카드 게임을 하고 있다. 이 카드 게임은 5회의 게임으로 진행되며, 그 총점으로 승부를 하는 게임이다. JOI군의 각 게임의 득점을 나타내는 정수가 주어졌을 때, JOI군의 총점을 구하는 프 www.acmicpc.net 코드 #include using namespace std; int main() { int a, sum = 0; for (int i = 1; i > a; sum = sum + a; } cout 2022. 11. 13. 이전 1 ··· 16 17 18 19 20 다음 반응형