- 1
const double pi = acos(-1.0);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1000
const double pi = acos(-1.0);
В каждой посылке codeforces - участника shentianxiao.
P.S. Он - китаец
−87
#!/usr/bin/python
import itertools, math, os, random, re, sys
random.seed (1234)
while True:
s = sys.stdin.readline ().strip ()
if s == '':
s = sys.stdin.readline ().strip ()
if s == '':
break
t = sys.stdin.readline ()
r = sys.stdin.readline ()
s = [c for c in s]
t = [c for c in t]
r = [c for c in r]
s.sort ()
t.sort ()
r.sort ()
ok = True
for c in r:
if len (s) > 0 and c == s[0]:
s = s[1:]
elif len (t) > 0 and c == t[0]:
t = t[1:]
else:
ok = False
ok = ok and len (s) == 0 and len (t) == 0
if ok:
print 'YES'
else:
print 'NO'
#Люди делают так:
#a, b, c = (raw_input() for i in range(3))
#print 'YES' if sorted(a + b) == sorted(c) else 'NO'
Задача такая: даны три строки: a, b и c
проверить что третья может быть получена из двух других преремешиванием
Источник:
codeforces, Codeforces beta 101 round, 1018183
−108
#import "FSAdaptor.h"
@implementation FSAdaptor
// NOTE: I hope that user won't manually disturb these fucking files.
// If this `very clever' user SUDDENLY jailbreaks his iShit and
// is still thinking that it is very good app than he is wrong:
// if file cannot be read or is renamed or another holy shit than
// all methods may return complete crap and the only way for him
// to be forgiven is to fuck himself. I hate these
// OH-MY-GOD-I-M-MUCH-MORE-CLEVER-THAN-THESE-DEVELOPERS people!
Не мог не запостить этот крик души. Приходится разгребать этот кусок того самого(
+161
///////////////////////////////////////////////
////////////
//Содержимое
function One($str,$tag,$num=1,$p=1){
if($num=='0'){ $num='1'; }
//Разделитель <тег
$see_st=explode('<'.$tag,$str);
if($p!==1){ $see_st=explode($p,$str);
$end=explode('>',$see_st[$num]);
$see_st[$num]='.'.$end[1];
}
//Разделитель </тег
$see_end=explode('</'.$tag,substr($see_st[$num],'1'));
return $see_end[0];
}
///////////////////////////////////////////////
/////////
//Парсинг
function Parse($go,$str=0){
if($str==0){ $str=$this->String; }
//Разбили путь
$path=explode("/",$go);
//Обрабатываем путь
for($go_n=0;$go_n<count($path);$go_n++){
//$go_n='2';
//Номер тега
$num=explode(':',$path[$go_n]);
if($num[1]==NULL){ $num[1]=1; }
if($go_n=='0'){ $string=$str;}else{ $string=$t[$go_n-1]; }
$t[$go_n]=$this->One($string,$num[0],$num[1]);
}
return $t[$go_n-1];
}
Тоже самое, но теперь с xmlD:
+160
function json($text,$name,$sm=0){
//$text - текст в формате json
//$name - название титла
//$sm - смещение влево
$text1=explode('"',$text);
for ($go=0;$go<count($text1);$go++){
if($text1[$go]==$name){ $res=$text1[$go+2-$sm]; break; }
}
return $res;
}
Грабельки)
+163
d = d ? d.push({ajax: true}) : {ajax: true};
Похоже, что программист отметил весело новый год
+157
function numword() {
$args = func_get_args();
$num = $args[0] % 100;
if ($num > 19) {
$num = $num % 10;
}
switch ($num) {
case 1: { return $args[1]; }
case 2:
case 3:
case 4: { return $args[2]; }
default: { return $args[3]; }
}
}
Склонение слов по числам
+162
function cut($text){
$full_text = explode("<cut/>",$text);
return $full_text;
}
Функция обрезания текста по тегу <cut/>
+162
function tegs($str){
if(!empty($str)){
$tegs = explode(',', $str);
$all_tegs = count($tegs);
$str_Tegs = '<a href="/tegs.php?search='.$tegs['0'].'">'.$tegs['0'].'</a>';
for($i = 1; $i<=$all_tegs-1; $i++){
$str_Tegs .= ', <a href="/tegs.php?search='.$tegs[$i].'">'.$tegs[$i].'</a>';
}
$str = $str_Tegs;
} else {
$str = 'Меток нет.';
}
return $str;
}
Правильный вывод меток
−89
def getResidueList():
resList = []
resList.append("366")
resList.append("367")
resList.append("368")
resList.append("369")
resList.append("370")
resList.append("371")
resList.append("372")
resList.append("373")
resList.append("374")
resList.append("375")
resList.append("376")
resList.append("377")
resList.append("378")
resList.append("379")
resList.append("380")
resList.append("381")
resList.append("382")
resList.append("383")
resList.append("384")
resList.append("385")
resList.append("386")
.... и так далее ...
resList.append("405")
resList.append("406")
resList.append("407")
resList.append("408")
resList.append("409")
resList.append("410")
resList.append("411")
resList.append("412")
resList.append("413")
resList.append("414")
... и так далее ....
resList.append("585")
resList.append("586")
resList.append("587")
resList.append("588")
resList.append("589")
return resList
Циклы? Не, не слышал