반응형

문제 출처 :


https://www.acmicpc.net/problem/12605



알고리즘 분석 :


문제 해결에 필요한 사항

1. 구현


이 문제는 http://www.crocus.co.kr/1038 이 링크에 매우 자세히 설명해 두었다.


이 페이지에는 AC 코드만 수록되어있습니다.













소스 코드 : 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
 
using namespace std;
 
int main()
{
    int n;
    scanf("%d "&n);
 
    for(int i = 1; i <= n; i ++)
    {
        string str;
        getline(cin, str);
        reverse(str.begin(), str.end());
        str += ' ';
        vector<string> vc;
 
        int len = str.size();
 
        int start = 0;
        for (int end = 0; end < len; end++)
            if (str[end] == ' ')
            {
                reverse(str.begin() + start, str.begin() + end);
                start = end + 1;
            }
 
        cout << "Case #" << i << ": " << str << endl;
    }
    return 0;
}
 
//                                                       This source code Copyright belongs to Crocus
//                                                        If you want to see more? click here >>
Crocus


반응형

'Applied > 알고리즘 문제풀이' 카테고리의 다른 글

[10473번] 인간 대포  (0) 2017.10.09
[1011번] Fly me to the Alpha Centauri  (0) 2017.10.09
[13334번] 철로  (0) 2017.09.25
[2213번] 트리의 독립집합  (0) 2017.09.25
[14716번] 현수막  (0) 2017.09.25