initial commit
This commit is contained in:
parent
0e75028455
commit
19cd88d7d3
38
266B Queue at the School/266B.cpp
Normal file
38
266B Queue at the School/266B.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include <bits/stdc++.h>
|
||||
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();
|
||||
}
|
30
677A Vanya and Fence/677A.cpp
Normal file
30
677A Vanya and Fence/677A.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
using ll = long long;
|
||||
|
||||
|
||||
void solve()
|
||||
{
|
||||
int n,h;
|
||||
cin>>n>>h;
|
||||
int w=0;
|
||||
for(int i=0; i<n; ++i)
|
||||
{
|
||||
int x;
|
||||
cin>>x;
|
||||
if(x>h) w=w+2;
|
||||
else w++;
|
||||
}
|
||||
cout<<w<<endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios_base::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int TC = 1;
|
||||
//cin >> TC;
|
||||
//cin.ignore();
|
||||
while (TC--) solve();
|
||||
}
|
Loading…
Reference in New Issue
Block a user