- 1
- 2
- 3
- 4
- 5
- 6
- 7
private static class Errors extends ArrayList<String> {
private static final long serialVersionUID = 1L;
}
private static class Notices extends ArrayList<String> {
private static final long serialVersionUID = 1L;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+73
private static class Errors extends ArrayList<String> {
private static final long serialVersionUID = 1L;
}
private static class Notices extends ArrayList<String> {
private static final long serialVersionUID = 1L;
}
две большие разницы
+74
private static class MyStatefulActor extends DefaultActor {
protected void act() {
loop(new Runnable() {
public void run() {
react(new MessagingRunnable<String>(this) {
protected void doRun(final String msg) {
System.out.println("Stage #0: " + msg);
react(new MessagingRunnable<Double>() {
protected void doRun(final Double msg) {
System.out.println(" Stage #1: " + msg);
react(new MessagingRunnable<List<Integer>>() {
protected void doRun(final List<Integer> msg) {
System.out.println(" Stage #2: " + msg + "\n");
}
});
}
});
}
});
}
});
}
}
}
+5
#include "iostream"
using namespace std;
void main ()
{
setlocale(LC_ALL,"Russian"); //Поддержка киррилицы
float A1,A2,A3,A4,A5;
int N;
int i;
cout<<"Введите количество выступлений"<<endl;
cin>>N; //Вводим кол-во выступлений
for(i=0;i<N;i++) //Вводим массив
{cout<<"Введите оценки за выступление"<<endl;
cout<<"Введите оценку 1"<<endl;
cin>>A1;
cout<<"Введите оценку 2"<<endl;
cin>>A2;
cout<<"Введите оценку 3"<<endl;
cin>>A3;
cout<<"Введите оценку 4"<<endl;
cin>>A4;
cout<<"Введите оценку 5"<<endl;
cin>>A5;
if(A1>A2&&A1>A3&&A1>A4&&A1>A5) {cout<<A1;}
else if (A2>A1&&A2>A3&&A2>A4&&A2>A5) {cout<<"Максимальная оценка = "<<A2<<endl; }
else if (A3>A1&&A3>A2&&A3>A4&&A3>A5) {cout<<"Максимальная оценка = "<<A3<<endl; }
else if (A4>A1&&A4>A2&&A4>A3&&A4>A5) {cout<<"Максимальная оценка = "<<A4<<endl; }
else if (A5>A1&&A5>A2&&A5>A3&&A5>A4) {cout<<"Максимальная оценка = "<<A5<<endl; }
}
}
ЗАДАЧА
Пожалуйста помогите составить для задачи на с++
Я решаю задачи, но блок схемы строить не могу
С ответов Гугла.
http://otvety.google.ru/otvety/thread?tid=5bd43c242dce51f8
+72
public boolean fastItemEquals(ItemStack st, ItemStack nd) {
if(nd == null) return false;
if(st.hashCode() != nd.hashCode()) return false;
if(st.getType() != nd.getType()) return false;
if(!st.getItemMeta().getDisplayName().equals(nd.getItemMeta().getDisplayName())) return false;
if(st.getEnchantments().size() != nd.getEnchantments().size()) return false;
if(st.getItemMeta().getLore().size() != nd.getItemMeta().getLore().size()) return false;
final List<String>
lst = st.getItemMeta().getLore(),
lnd = nd.getItemMeta().getLore();
for(int i = 0 ; i < st.getItemMeta().getLore().size() ; i++)
if(!lst.get(i).equals(lnd.get(i))) return false;
//return st.isSimilar(nd);
return true;
}
public void fastItemRemove(Inventory inv, ItemStack st) {
for(int i = 0 ; i < inv.getContents().length ; i++)
if(fastItemEquals(st, inv.getContents()[i])) inv.clear(i);
}
+124
@set /p d=<%0
%d:~0,5%a=%d:~0,5%
%a%c=%d:~9,1%
%a%b%c%%d:~4,1%&%a%i%c%%d:~0,1%&%a%k%c%&%a%l%c%&%a%m%c%&%a%n%c%&%a%o%c%&%a%p%c%&%a%q%c%&%a%r%c%&%a%s%c%&%a%t%c%&%a%u%c%&%a%v%c%&%a%w%c%&%a%x%c%&%a%y%c%&%a%z%c%
%k%c%l%o%m%l%n%o%o%r%b%1%p%a%q%&%i%m%r%o%s%d%t%e%b%c%u%o%v%n%b%c%w%o%x%l%y%s%c%1%z%4%b%l%k%i%l%n%m%e%n%s%c%4%o%&%a%f%c%п%p%&%a%g%c%«%q%&%a%h%c%Ѓ%r%&%a%j%c%Д%s%&%a%e%c%!%t%&%u%t%v%i%w%t%x%l%y%e%b%.
%i%e%k%c%t%h%s%o%b%%b%Ъ%j%%j%%j%%j%%j%%j%%j%%j%%j%ї%r%&%i%e%q%c%p%h%o%o%b%%b%і%b%%b%%h%%g%%f%%b%%e%%b%%b%і%n%&%i%e%m%c%l%h%k%o%b%%b%А%j%%j%%j%%j%%j%%j%%j%%j%%j%Щ%b%&%v%p%o%a%y%u%x%s%p%e%u%>%q%n%k%u%m%l%o%
Должно быть запущено на русскоязычной Windows, сохраните в .bat файл, а на концах строчек (6 строк) не должно быть лишних пробелов!
Ссылка на зипованную версию:
http://klimaleksus.narod.ru/Files/C/fuck.zip
+37
int hamming(int i, int j, vector<state>& net) //returns Hamming distance between i and j nodes
{
int res = 0;
if (net[i].nodes[0] != net[j].nodes[0])
{
res++;
}
if (net[i].nodes[1] != net[j].nodes[1])
{
res++;
}
if (net[i].nodes[2] != net[j].nodes[2])
{
res++;
}
if (net[i].nodes[3] != net[j].nodes[3])
{
res++;
}
if (net[i].nodes[4] != net[j].nodes[4])
{
res++;
}
if (net[i].nodes[5] != net[j].nodes[5])
{
res++;
}
if (net[i].nodes[6] != net[j].nodes[6])
{
res++;
}
if (net[i].nodes[7] != net[j].nodes[7])
{
res++;
}
if (net[i].nodes[8] != net[j].nodes[8])
{
res++;
}
if (net[i].nodes[9] != net[j].nodes[9])
{
res++;
}
if (net[i].nodes[10] != net[j].nodes[10])
{
res++;
}
if (net[i].nodes[11] != net[j].nodes[11])
{
res++;
}
if (net[i].nodes[12] != net[j].nodes[12])
{
res++;
}
return res;
}
Человеку срочно нужно узнать про существование циклов.
+36
#include <iostream>
class StaticClassData {
int *pointer, value;
public:
StaticClassData(): pointer(&value) {}
void add(int i) {
std::cout << "Hello, this is " << this << std::endl;
value = i;
std::cout << "I'm fine" << std::endl;
*pointer = i;
std::cout << "You never read this text" << std::endl;
}
};
class SomeClass {
struct StaticConstructor {
StaticConstructor(){ storage.add(1); }
};
static StaticConstructor constructor;
static StaticClassData storage;
};
SomeClass::StaticConstructor SomeClass::constructor;
StaticClassData SomeClass::storage;
int main(){}
Долго думал, с какого хрена программа падает на заполнении static поля в "статическом конструкторе". Поле вроде бы есть, но толку от этого мало.
http://ideone.com/Ux14ep - из раздела ub.govnokod.ru или как выстрелить себе в ногу до выполнения main.
+175
if(!$item["region"])
$item["region"] = "Москва";
if($item["region"])
$text = str_replace('<option>'.$item["region"].'</option>', '<option value="'.$item["region"].'" selected>'.$item["region"].'</option>', $text);
Гениальнейшая простановка selected для выбранного option в форме
+143
if (medicalRecords == null)
new List<MedicalRecordDispatchingInfoViewModel>();
Просто сделай мне лист
+152
...
## $config['components'] - массив компонентов(>25) для Yii
foreach ($config['components'] as $name => $component) {
if ($name != 'db') {
unset($config['components'][$name]);
}
}
...
# потом был баг фикс
foreach ($config['components'] as $name => $component) {
if ($name != 'db' && $name != 'db_stats') {
unset($config['components'][$name]);
}
}
Сделал один из наших программистов, потом другой добавил свое, и уже я , с утра, в безсознательном состоянии, хотел было добавить ещё условие " && $name != 'format'" , но увидев результат, в голове бзынкнуло - WTF I AM DOING!!!
cделал так
$config['components'] = array_intersect_key($config['components'], array('db'=>1, 'db_stats'=>1, 'format' => 1));