- 1
- 2
- 3
- 4
- 5
- 6
- 7
def f(m, n):
if m == 0:
return n + 1
elif n == 0:
return f(m - 1, 1)
else:
return f(m - 1, f(m, n - 1))
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
def f(m, n):
if m == 0:
return n + 1
elif n == 0:
return f(m - 1, 1)
else:
return f(m - 1, f(m, n - 1))
0
<script src="3.js"></script>
<script> alert("part2") </script>
<script src="1.js"></script>
в 3.js
'use strict'
let age = Number(null)
alert(age)
почему-то результат разный = то part2 то 0, ничего не меняю, просто результат разный каждый раз
0
$dbSort = Array("SORT" => "ASC");
$dbFilter = Array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "ID" => $arResult["ID"]);
$dbSelect = Array("UF_MODEL_HEADLINE", "UF_CALC_HEADLINE", "UF_H1", "UF_ADVANTAGE_TITLE");
$db_list = CIBlockSection::GetList($dbSort, $dbFilter, false, $dbSelect);
$result = $db_list->GetNext();
$arResult["MODEL_HEADLINE"] = $result["UF_MODEL_HEADLINE"];
$arResult["CALC_HEADLINE"] = $result["UF_CALC_HEADLINE"];
$arResult["UF_H1"] = $result["UF_H1"];
$arResult["UF_ADVANTAGE_TITLE"] = $result["UF_ADVANTAGE_TITLE"];
0
import std.stdio;
import std.conv: to;
import std.json;
import std.path;
import std.file;
import std.process;
import std.string: strip;
import std.array;
import core.stdc.stdlib;
import core.exception: RangeError;
void addServer(string* serverName, string* serverPath, int* t)
{
JSONValue content = parseJSON(readConfig());
string[][] json_arr;
if (content.array().length != 0)
for (int i = 0; i < content.array().length; ++i) {
string ps;
for (int x = 0; x < content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1].length; ++x)
if (content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x] != '\\')
ps ~= content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x];
json_arr ~= [
content[i].toString.strip("[\"").strip("\"]").split("\",\"")[0],
to!string(ps),
content[i].toString.strip("[\"").strip("\"]").split("\",\"")[2]
];
}
foreach (string[] key; json_arr)
if (key[0] == *serverName)
crash("This server already exists!");
json_arr ~= [
*serverName,
*serverPath,
to!string(*t)
];
std.file.write(config, JSONValue(json_arr).toPrettyString);
}
void getServerList()
{
writeln("\tServer:\tPath:\tTime:");
immutable content = parseJSON(readConfig());
for (int i = 0; i < content.array().length; ++i) {
string ps;
for (int x = 0; x < content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1].length; ++x)
if (content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x] != '\\')
ps ~= content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x];
writeln('\t',
content[i].toString.strip("[\"").strip("\"]").split("\",\"")[0], ' ',
to!string(ps), ' ',
content[i].toString.strip("[\"").strip("\"]").split("\",\"")[2]
);
}
}
Парочка функций на языке D. Одна добавляет данные в JSON-файл, вторая их оттуда берёт и печатает в консоль.
+2
#include <iostream>
using namespace std;
bool check(int a, int b){
int ass[10] = {0}, bass[10] = {0};
while(a){
ass[a % 10]++;
bass[b % 10]++;
a /= 10;
b /= 10;
}
for(int i = 0; i < 10; i++){
if(ass[i] != bass[i]) return false;
}
return true;
}
int main() {
for(int i = 1; i < 10; i++){
for(int j = 0; j < 10; j++){
for(int k = 0; k < 10; k++){
for(int l = 0; l < 10; l++){
for(int m = 0; m < 10; m++){
for(int n = 0; n < 10; n++){
for(int o = 0; o < 10; o++){
for(int p = 0; p < 10; p++){
for(int r = 1; r < 10; r++){
long long a =
i * 100000000
+ j * 10000000
+ k * 1000000
+ l * 100000
+ m * 10000
+ n * 1000
+ o * 100
+ p * 10
+ 3;
long long z = r * 10000000
+ r * 1000000
+ r * 100000
+ r * 10000
+ r * 1000
+ r * 100
+ r * 10
+ r;
if(check(a, a + z)){
cout << a << " " << z << endl;
}
}
}
}
}
}
}
}
}
}
}
Коротко о переборах.
+1
var param1 = { name: product.prod_option, values: product.prod_variants};
var param2 = { name: product.prod_option2, values: product.prod_variants2};
var param3 = { name: product.prod_option3, values: product.prod_variants3};
var param4 = { name: product.prod_option4, values: product.prod_variants4};
var param5 = { name: product.prod_option5, values: product.prod_variants5};
t_store_product_addOneOptionsControl('modificator', param1 , optionsWrapper, options);
t_store_product_addOneOptionsControl('modificator', param2, optionsWrapper, options);
t_store_product_addOneOptionsControl('modificator', param3, optionsWrapper, options);
t_store_product_addOneOptionsControl('modificator', param4, optionsWrapper, options);
t_store_product_addOneOptionsControl('modificator', param5, optionsWrapper, options);
−2
Граждане!
Пишите код на высокоуровневых языках!
Например, на паскале.
Программы на пасцале удобочитаемы, даже можно чуть вникнуть в задачу кода.
А то - хуй пойми, что означает например вот это:
byte_t vector_mult(const std::array<byte_t, 4>& v1, std::array<byte_t, 4>&& v2) {
std::transform(begin(v1), end(v1), begin(v2), begin(v2),
[](byte_t x, byte_t y) { return mapper.at(y)(x); });
return std::accumulate(begin(v2), end(v2), byte_t(0), std::bit_xor<byte_t>());+1
-- ввод
io.write('Введите число: ')
x=tonumber(io.read())
-- проверка
-- 1-я часть
pro=0
e=true
io.write("0")
for i=1,x do
if e then
io.write(' + '..i)
pro = pro+i
else
io.write(' - '..i)
pro = pro-i
end
e = not e
end
print(" = "..pro)
a1 = pro
-- 2-я часть
pro=1
e=true
for i=1,x-1,2 do io.write('(') end
io.write("1")
for i=1,x do
if e then
io.write(' + '..i)
pro = pro+i
else
io.write(')/'..i)
pro = pro/i
end
e = not e
end
print(" = "..pro)
a2 = pro
------------------------------
if (a1<0 and a2==1) then print('Число четное')
elseif (a1>=0 and a2~=1) then print('Число нечетное')
end
Проверка четности числа (работает для чисел >= 1)
0
private List<string> StrSplit(string str)
{
if (!string.IsNullOrEmpty(str))
return str.Split(new char[] { ',', ';', ':' }, StringSplitOptions.RemoveEmptyEntries).ToList();
return null;
}
−4
Who is watching this amazing video in 2019???)
--------------------------------------------------------------------
2019 anyone????
--------------------------------------------------------------------
Still dope in 2019!!!
--------------------------------------------------------------------
2019 anyone?
--------------------------------------------------------------------
2019 anyone?
--------------------------------------------------------------------
WHO IS LISTENING TO THIS IN JUNE 2019?
--------------------------------------------------------------------
July 2019?
--------------------------------------------------------------------
who's watching in July 2019?
Правила пользования "YouTube" должны состоять лишь из одного запрета - НЕ ПОСТИТЬ, БЛЯДЬ, ЭТУ ХУЙНЮ ЕБУЧУЮ ПОД КАЖДЫМ ВИДЕО, КОТОРОМУ БОЛЬШЕ ГОДА. ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ.
ЗАЕБАЛИ, БЛЯДЬ. ПРОСТО ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ. ЗАЕБАЛИ.