diff --git a/266B Queue at the School/266B.cpp b/266B Queue at the School/266B.cpp new file mode 100644 index 0000000..15f7988 --- /dev/null +++ b/266B Queue at the School/266B.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +using ll = long long; + +void solve() +{ + int n, t; + cin >> n >> t; + string s; + cin >> s; + while (t--) + { + for (int i = 0; i < n - 1; ++i) + { + if (s[i] == 'B' && s[i + 1] == 'G') + { + char c; + c = s[i]; + s[i] = s[i + 1]; + s[i + 1] = c; + i++; + } + } + } + cout << s; +} + +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + + int TC = 1; + // cin >> TC; + // cin.ignore(); + while (TC--) + solve(); +} \ No newline at end of file diff --git a/677A Vanya and Fence/677A.cpp b/677A Vanya and Fence/677A.cpp new file mode 100644 index 0000000..2980848 --- /dev/null +++ b/677A Vanya and Fence/677A.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +using ll = long long; + + +void solve() +{ + int n,h; + cin>>n>>h; + int w=0; + for(int i=0; i>x; + if(x>h) w=w+2; + else w++; + } + cout<> TC; + //cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file