목록백준 문제풀이 (30)
Creative Code
https://www.acmicpc.net/problem/17214 17214번: 다항 함수의 적분 첫째 줄에 최대 일차 일변수 다항식이 주어진다. 항의 개수는 최대 2개이고, 변수는 항상 x로 주어지며, 각 항은 공백 문자로 구분되지 않는다. 주어지는 계수는 절댓값이 10,000을 넘지 않는 0이 www.acmicpc.net #include #include using namespace std; int main() { string str; cin >> str; int a = 0; int b = 0; if (str.find('x') != string::npos) { string str1 = ""; int index = 0; while (str[index] != 'x') { str1 += str[index]..
https://www.acmicpc.net/problem/16496 #include #include #include #include using namespace std; bool compare(string a, string b) { return a + b > b + a; } string solution(vectornumbers) { string max; string answer; vectornumber; for (int i = 0; i < numbers.size(); i++) { number.push_back(to_string(numbers[i])); } sort(number.begin(), number.end(), compare); for (int k = 0; k < number.size(); k++)..
https://www.acmicpc.net/problem/7869 7869번: 두 원 첫째 줄에 두 원의 중심과 반지름 x1, y1, r1, x2, y2, r2가 주어진다. 실수는 최대 소수점 둘째자리까지 주어진다. www.acmicpc.net #include #include #include #include #define PI 3.14159265358979 using namespace std; int main() { double x1, y1, r1, x2, y2, r2; cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2; cout
https://www.acmicpc.net/problem/2981 2981번: 검문 트럭을 타고 이동하던 상근이는 경찰의 검문을 받게 되었다. 경찰은 상근이가 운반하던 화물을 하나하나 모두 확인할 것이기 때문에, 검문하는데 엄청나게 오랜 시간이 걸린다. 상근이는 시간 www.acmicpc.net #include #include #include #include using namespace std; int gcd(int a, int b){ int c; while (b != 0) { c = a % b; a = b; b = c; } return a; } int main() { int N; cin >> N; vectornum; ios_base::sync_with_stdio(false); cin.tie(NULL);..
https://www.acmicpc.net/problem/2447 2447번: 별 찍기 - 10 재귀적인 패턴으로 별을 찍어 보자. N이 3의 거듭제곱(3, 9, 27, ...)이라고 할 때, 크기 N의 패턴은 N×N 정사각형 모양이다. 크기 3의 패턴은 가운데에 공백이 있고, 가운데를 제외한 모든 칸에 별이 www.acmicpc.net #include using namespace std; void star(int i, int j, int n) { if (i / n % 3 == 1 && j / n % 3 == 1) { cout n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { star(i, j, n); } cout