아이디어문제 8

DAY4 고급 - 백준 2505번 (C++)

www.acmicpc.net/problem/2505 2505번: 두 번 뒤집기 첫줄에는 숫자판의 크기를 나타내는 정수 N (5≤N≤10,000)이 주어진다. 그 다음 줄에는 두 개의 구간이 뒤집혀진 놀이판의 상태를 나타내는 숫자들이 하나의 공백을 두고 나타난다. www.acmicpc.net #include #include using namespace std; void reverse(int array[], int left, int right) { if(left < right) { swap(array[left],array[right]); reverse(array,left+1,right-1); } } int main() { int n; int array[10001] = {0}; int temp[10001] =..

DAY2 고급 - 백준 13022번 (C++)

www.acmicpc.net/problem/13022 13022번: 늑대와 올바른 단어 첫째 줄에 단어가 주어진다. 단어는 w, o, l, f로만 이루어져 있으며, 길이는 50을 넘지 않는다. www.acmicpc.net #include using namespace std; int main() { char input = ' '; int count[4] = {0}; while(input != '\n') { cin.get(input); //주기상 처음, w 입력 if(input == 'w') { count[0]++; } //종료 입력 else if(input == '\n') { //주기상 정상종료 if(count[0] == 0) { cout

백준 1002번 (C++)

www.acmicpc.net/problem/1002 1002번: 터렛 각 테스트 케이스마다 류재명이 있을 수 있는 위치의 수를 출력한다. 만약 류재명이 있을 수 있는 위치의 개수가 무한대일 경우에는 -1을 출력한다. www.acmicpc.net #include #include using namespace std; void swap(double *r1, double *r2) { double temp = *r1; *r1 = *r2; *r2 = temp; } int main() { int t; int x1,x2,y1,y2; double r1,r2; double distance; cin>>t; while(t-- > 0) { cin>>x1>>y1>>r1>>x2>>y2>>r2; distance = sqrt(pow(..

백준 1011번 (C++)

www.acmicpc.net/problem/1011 1011번: Fly me to the Alpha Centauri 우현이는 어린 시절, 지구 외의 다른 행성에서도 인류들이 살아갈 수 있는 미래가 오리라 믿었다. 그리고 그가 지구라는 세상에 발을 내려 놓은 지 23년이 지난 지금, 세계 최연소 ASNA 우주 비행�� www.acmicpc.net #include #include using namespace std; int main() { int t; unsigned int x, y, term; int afterMath; int result = 0; int temp; cin>>t; while(t-- > 0) { cin>>x>>y; term = y-x; afterMath = sqrt(term); if(term..

백준 2839번 (C++)

www.acmicpc.net/problem/2839 2839번: 설탕 배달 문제 상근이는 요즘 설탕공장에서 설탕을 배달하고 있다. 상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다. 설탕공장에서 만드는 설탕은 봉지에 담겨져 있다. 봉지는 3킬� www.acmicpc.net #include using namespace std; int main() { int n; int count3 = 0, count5 = 0; int rest; bool find = false; cin>>n; count5 = n/5; rest = n%5; if(rest == 0) cout

백준 2941번 (C++)

www.acmicpc.net/problem/2941 2941번: 크로아티아 알파벳 문제 예전에는 운영체제에서 크로아티아 알파벳을 입력할 수가 없었다. 따라서, 다음과 같이 크로아티아 알파벳을 변경해서 입력했다. 크로아티아 알파벳 변경 č c= ć c- dž dz= đ d- lj lj nj nj š s= www.acmicpc.net #include using namespace std; int main() { string input; string temp; int count = 0; int i = 0; cin>>input; while(i