diff --git a/266B - Queue at the School.cpp b/266B - Queue at the School.cpp index 6939dbd..0d9d43f 100644 --- a/266B - Queue at the School.cpp +++ b/266B - Queue at the School.cpp @@ -1,26 +1,34 @@ //4021768 Jul 4, 2013 7:57:17 PM fuwutu 266B - Queue at the School GNU C++0x Accepted 15 ms 0 KB #include #include - using namespace std; -int main() -{ - int n, t; - string s; - cin >> n >> t >> s; - while (t--) - { - for (int i = 1; i < n; ++i) - { - if (s[i] == 'G' && s[i-1] == 'B') - { - s[i] = 'B'; - s[i-1] = 'G'; - ++i; +string swap_action(string str){ + for(int i = 1; i> student >> t; + cin.ignore(); + + getline(cin, s); + + for(; t > 0; t--){ + s = swap_action(s); } + cout << s << endl; + return 0; }