Skip to content

Instantly share code, notes, and snippets.

@kusano
Created June 8, 2015 17:45
Show Gist options
  • Save kusano/e337673815ee92fc32a9 to your computer and use it in GitHub Desktop.
Save kusano/e337673815ee92fc32a9 to your computer and use it in GitHub Desktop.
TopCoder C++11
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
constexpr int f(int a) {return a+a;}
int v[f(10)];
class Cyclemin{public:
string bestmod(string s, int k)
{
vector<vector<int>> x = {{1, 2}, {3, 4}};
vector<string> c;
auto a = s;
for (char _: a)
{
s = s.substr(1)+s[0];
c.push_back(s);
}
for_each(c.begin(), c.end(), [=](string &s) -> void
{
int kk = k;
for (char &c: s)
if (c!='a' && kk --> 0)
c = 'a';
});
return *min_element(c.begin(), c.end());
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment