投稿(暂未实现)

奇怪的编程小技巧 #没用的小知识又增加了

1. i++ ++ ++ ++ ++; (意为i+=5)

2. ++i---=++a+++c==b---=--c-- (过于复杂,自行理解)

( ++ i -- -= ++ a ++ + c == b -- -= -- c -- )

3. for(int i=0; c=a+b,d=c*a,cout<<b*d,i<10,cin>>a>>b; i++) {}

(for里面两个分号中间可以用逗号连接多个语句,可以用来《简化代码》、《压行》,但也没让你这么压行)

(第二个分号后也行,懒得弄了)

4.
//*
int a=1; /*/ int b=2; /*/ int c=3; /*/ int d=4; (......) //*/

(请复制到C/C++编辑器里并尝试删除第一个‘/’)

5. for(int i=0; i<n; i+=n) {}

(提供者:\ahttps://www.luogu.com.cn/user/1086408\H.Wander\-)

6. (这是C程序) //输出:hellow world long long O=-~(O-O),_,o; //O=1 main(){ for(o-=o;(O<<(O<<(O<\<\O)))^o;o-=o+~o) //循环17次 _|=O<<("`_\\ZXVUTQPOMLJGC"[o]&63); //按二进制给 _ 写入8进制数据 for(o-=o;o^11;o-=o+~o,_>>=3) putchar("helowrd "[_&7]); //_的每位对应"hellow world"的每个字符 //"helowrd "的长度刚好为8 } (提供者:\ahttps://www.luogu.com.cn/discuss/142324\Houmy\-)

一些小技巧发展史

1. 自己继承自己(python):

第一版:纯好玩

class A: path class A(A): path

第二版:比较扯

class A: def __init__(): return A class A(A()()(A()(A(A()()))()())()(A()(A())())): path

第三版:藏变量

(别人的代码:) class Integer: int x (我藏了个y:) class Integer(Integer): int y

第四版:概率出BUG

!!!请不要在多人大型项目里食用,出现分歧概不负责!!!

(别人的代码:) class Integer: int x (我的代码) class Integer(Integer): def __init__(): if(random()<0.01) x+=random()/100 x*=(random()*2)-1 x-=random()/10

一些不合法的神奇程序/片段

1. 当5年C++用户学了1年python后回归C++写出的\cred\Cython++\-:

#import \<\ iostream> def main(): int { a = Input() printf(f"a={a}") print("a+b=%d", scanf("%d")) return 0 }

2. new int >> n[114];

3. 我(入门是Python,主要学C++,写了很多js(为了做网站))写的奇葩代码(\cred\Cython++ Script\-):

for(let i in range 10) { console.log("{i}") }

判卷老师:你做对了,但我不想给分

1. 倍长AB至C使AB=BC

2. 过A作AC//AB使AC=BC=AB/2

3. 对于▲ABC和▲DEF: AB = DE BC = EF CA = FD ∴▲ABC≌▲DEF(SSS) ∴∠ABC = ∠DEF 对于▲ABC和▲DEF: AB = DE ∠ABC = ∠DEF BC = EF ∴▲ABC≌▲DEF(SAS) QED