- 1
.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
.
Справедливо ли утверждение о том, что большинство из присутствующих дрочатся с программированием и прочей ойти хуйней почти всё свободное и всё рабочее время?
0
while True:
prev_word = next_word
if next_word.is_empty():
next_word = random.choice(words)
else:
next_word = chain.get_next_word(next_word.root, lambda: Text.Word(''))
suffix = suffix_chain.get_next_word((prev_word.suffix, next_word.root), lambda: '')
if len(suffix) == 0:
suffix = next_word.suffix
punct = punct_chain.get_next_word(next_word.root, lambda: '')
if len(output_words) == 0 or output_words[-1].is_ending_word():
res_word = Text.PunctedWord(next_word.root.capitalize(), suffix, punct)
else:
res_word = Text.PunctedWord(next_word.root, suffix, punct)
output_words += [res_word]
generated_chars += len(res_word)
if chars_max_count > 0 and generated_chars > chars_max_count:
break
if words_max_count > 0 and len(output_words) > words_max_count:
break
Вореции. Генерации. Кобенации. Теперь в энтерпрайз почти ООП-стиле!
s: https://github.com/gost-gk/vorec-enterprise
+1
#include <bits/stdc++.h>
using namespace std;
vector <pair<int,int> > vpp;
long long vres = 0;
int get_dist(pair<int,int> l, pair<int,int> r)
{
int ans1 = abs(l.first - r.first);
int ans2 = abs(l.second - r.second);
return ans1 + ans2;
}
pair<vector <pair<int,int> > , long long> rec(const string &s, int id,long long len,pair<int,int> pos,vector <vector <pair<int,int> > > &cl, vector <pair<int,int> > p)
{
if(id == (int)s.size())
return {p,len};
int st = s[id] - 'a';
pair<vector <pair<int,int> > , long long> ans,tmp;
for(int j = 0; j < (int)cl[st].size(); ++j)
{
p.push_back({cl[st][j]});
tmp = rec(s,id + 1, len + get_dist(pos, cl[st][j]), cl[st][j], cl,p);
if(tmp.second >= ans.second)
{
ans = tmp;
}
p.pop_back();
}
return ans;
}
#define mag pair< pair< vector< pair<int,int> > , long long> , pair< pair< int,int >,pair< int,int > > >
mag raz(int l, int r,const string &s,vector <vector <pair<int,int> > > &cl)
{
mag v1,v2;
vector <pair<int,int> > p;
if(r - l >= 1)
{
int tm = (l + r) >> 1;
v1 = raz(l,tm,s,cl);
bool f = 1;
if(tm + 1 > r)
{
v2 = v1;
f = 0;
}
else
v2 = raz(tm + 1,r,s,cl);
// int st1 = ar[v1.second.first.first][v1.second.first.second];
// int st2 = ar[v2.second.first.first][v2.second.first.second];
long long len = 0;
///merge
int n = (int)v1.first.first.size();
len += v1.first.second;
for(int i = 0; i < n; ++i)
{
p.push_back(v1.first.first[i]);
}
if(f)
{
len += v2.first.second;
int n = (int)v2.first.first.size();
for(int i = 0; i < n; ++i)
{
p.push_back(v2.first.first[i]);
}
}
len += get_dist(v1.second.second, v2.second.first);
return {{p,len}, {v1.second.second, v2.second.first}};
}
int st = s[l] - 'a';
int x1 = rand() % (int)cl[st].size();
p.push_back(cl[st][x1]);
// cout << cl[st].size() << " " << l << " " << r <<'\n';
return {{p,0},{cl[st][x1],cl[st][x1]}};
}
//pair<int,vector <pair<int,int> > > solve(ifstream &cin, ofstream &cout)
void solve(ifstream &cin, ofstream &cout)
{
vector <int> used(26);
vector <vector <pair<int,int> > > cl(26);
int n, m ,l;
cin >> n >> m >> l;
vector <vector <char > > ar(n,vector <char> (m));
for(int i = 0; i < n; ++i)
{
for(int j = 0; j < m; ++j)
{
cin >> ar[i][j];
}
}
string s;
cin >> s;
for(int i = 0; i < n; ++i)
{
+2
struct ApplyFunctor {
template <typename Rules, typename ... Args>
bool operator()(const Rules &rules, Args && ... args) const {
for (const auto &rule : rules) {
if (!rule.apply(std::forward<Args>(args)...))
return false;
}
return true;
}
};
Perfect forwarding, сцуко, такой perfect. Но все же не заменяет мозг.
−1
.
Есть ли в нашем community те, кто пишут на "PHP" 15 и более лет и в хуй не дують?
+2
-- Pipe Elbow ****************************************************************************
pipe_elbow = util.table.deepcopy(data.raw["storage-tank"]["storage-tank"])
pipe_elbow.name = "pipe-elbow"
pipe_elbow.icon = "__Flow Control__/graphics/icon/pipe-elbow.png"
pipe_elbow.minable = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].minable
pipe_elbow.corpse = "small-remnants"
pipe_elbow.max_health = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].max_health
pipe_elbow.resistances = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].resistances
pipe_elbow.fast_replaceable_group = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].fast_replaceable_group
pipe_elbow.collision_box = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].collision_box
pipe_elbow.selection_box = data.raw["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"]["pipe"].selection_box
Пип Еблов.
Factorio mod Flow Control_3.0.3
--Завышеное ЧСВ или самолюбование?
0
Жил был Иван. Было у него всё - и деньги, и машина, и секс, и родители, и дом и, вообщем, много чего ещё.
И вот решил как-то Ваня выучить php. Выучил, и тут же всё потерял, потому что разучился думать и деградировал до состояния двутавровой балки.
−2
Решил я зайти на сайт и увидел в адресе .php.
Больше я не заходил на этот сайт.
−1
.
Предлагаю написать топ 10 местных программистов, руководствуясь общением с ними в комментариях или восхищением глубиной знаний.
−101
жопаembler — гниль