본문 바로가기

백준27

백준 1463번 : 1로 만들기 [C++] 주소 : https://www.acmicpc.net/problem/1463 1463번: 1로 만들기 첫째 줄에 1보다 크거나 같고, 106보다 작거나 같은 정수 N이 주어진다. www.acmicpc.net 소스 코드 : #define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int arr[1000001]; int operation = 0; arr[1] = 0; arr[2] = 1; arr[3] = 1; int N; cin >> N; for (int i = 4; i 2022. 8. 28.
백준 1003번 : 피보나치 함수 [C++] 주소 : https://www.acmicpc.net/problem/1003 1003번: 피보나치 함수 각 테스트 케이스마다 0이 출력되는 횟수와 1이 출력되는 횟수를 공백으로 구분해서 출력한다. www.acmicpc.net 소스 코드 : #define _CRT_SECURE_NO_WARNINGS #include using namespace std; typedef struct { int number; int one; int zero; }Num; void fibonacci(int n) { Num N[41]; if (n == 0) { cout 2022. 8. 28.
백준 17219번 : 비밀번호 찾기 [C++] 주소 : https://denise.tistory.com/manage/newpost/?type=post&returnURL=%2Fmanage%2Fposts%2F TISTORY 나를 표현하는 블로그를 만들어보세요. www.tistory.com 소스 코드 : #define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; typedef struct { string address; string password; }Person; bool compare(Person a, Person b) { return a.address < b.address; } int main() { ios_base::sync_with_stdio(false);cin... 2022. 8. 28.
백준 11399번 : ATM [C++] 주소 : https://www.acmicpc.net/problem/11399 11399번: ATM 첫째 줄에 사람의 수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어진다. (1 ≤ Pi ≤ 1,000) www.acmicpc.net 소스 코드 : #define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int N; int sum = 0; vector v; cin >> N; for (int i = 0;i < N;i++) { int.. 2022. 8. 26.