【整活】P1001 的一百种 AC 方式

· · 休闲·娱乐

1.(C)

a,b;

#define put
#define into
#define Cs ;scanf("%d",&a); 
#define H2O ;b+=a;H2
#define CsOH ;printf("%d",b)
#define H2 1

int main(){
    put Cs into H2O;
    2 Cs + 2 H2O == 2 CsOH + H2;
}

2.(C)

a,b;
#define aq 0
int Cs(int x){
    scanf("%d%d",&a,&b);
    printf("%d",a+b);
    return x;
}
int main(){
    return Cs(aq);
}

好了好了,不搞 Caesium 了

3.(C++)

#include<bits/stdc++.h>
#define Hi using
#define judger namespace
#define please std;
#define help int
#define me main(){int
#define AC a,b;
#define this cin>>a>>b;
#define A cout<<a+b;
#define plus return
#define B 0;
#define problem }

Hi judger please help me AC this A plus B problem
  1. (Python)
s=""
def O(a,f=None):
    global s
    if f!=None:
        s+=chr(a*2)
    return a*2
def o(a,f=None):
    global s
    if f!=None:
        s+=chr(a*2+1)
    return a*2+1
def A():
    a,b=input().split();
    a,b=int(a),int(b)
    print(a+b)
o(O(O(O(O(O(o(0)))))),0);O(O(O(o(O(o(0))))),0);o(O(O(o(O(o(0))))),0)
eval(s)
  1. (Python/C/Objective C)
a=1//(exec("a,b=input().split();print(int(a)+int(b))")or 1);'''
;
#include<stdio.h>
main(b){scanf("%d%d",&a,&b);printf("%d",a+b);}
//'''

5.5 (Python/C/C++/Objective C)

#define x int a
x=1//(exec("a,b=input().split();print(int(a)+int(b))")or 1);'''
;
#include<stdio.h>
int b;
main(){scanf("%d%d",&a,&b);printf("%d",a+b);}
//'''
  1. (Python,藏头)
A=input().split()

p=int(A[0])
l=int(A[1])
u=p+l
s=str(u)

B=print(s)

7.(Python,真·面向对象编程)

class Number:
    def __init__(self,num):
        self.num=num
    def __add__(self,other):
        return Number(self.num+other.num)
class AplusBHandler:
    def __init__(self):
        self.numA=Number(0)
        self.numB=Number(0)
    def input(self):
        input_buffer=input().split()
        self.numA.num,self.numB.num=int(input_buffer[0]),int(input_buffer[1])
    def calculate(self):
        self.result=self.numA+self.numB
    def output(self):
        print(self.result.num)
handler=AplusBHandler()
handler.input()
handler.calculate()
handler.output()

8.(Python)

exec("class _:\n    def __init__(x):pass\n    def __add__(x,y):\n        a,b=input().split()\n        a,b=int(a),int(b)\n        print(a+b)\nA=_()\nB=_()")











A+B

8.5 (Python)

exec("class _:\n    def __init__(x):pass\n    def __add__(x,y):\n        a,b=input().split()\n        a,b=int(a),int(b)\n        print(a+b)\nA=_()\nB=_()\ndef analyze(x):return x.split()[0]")










def solve(problem):
    return eval(analyze(problem))
solve("A+B problem")

9.(Python,《114514》)

import sys



exec     ("".      join  ("""     a,b=input     ().s    plit  ();a
  ,b       =i      nt(a  ),in     t(              b)    ;res  =a+b
  ;r       es      =str(res);     sys.stdou       t.    write(res)
  ;s       ys            .std            ou       t.          writ
e(chr(1  0));ex          it()     """.split     ()))##        ####

10.(C,最正常的一个)

a,b;main(){scanf("%d%d",&a,&b);printf("%d",a+b);}

11.(C,但是很难调试,而且你被骗了)

#ifdef ONLINE_JUDGE
a,b;main(){scanf("%d%d",&a,&b);printf("%d",a+b);}
#else
#define a "ruM8oPUJ.,"
#define c "45X.7AsPi7m5RqBmIPnTjuKDMC1OnMruM.g"a
#define d "N2KQsoZoA0gZiQtEhu3r,2KQsoZoA0g1KNVdQBg6ZFTjuKDMC1OnX\
O3yiUO0EWnhSzjeJpEhu.0Lsr2zZwG2WcIBW6MXrX9PkKJSZMTbUqmBm5WW4j9Pk\
KJSZMTbUzfR2dA0e2bO9NPgE8oP9PkKJSZMTbSYkK3H1n0F9PkKJSZMTbTzj7W6M\
XUS37svjhzNnAdCAn2clQnhSdr7gsriZ3H1pTjuKDMC1OnSaOM8oPSuCFAsPi7m5\
RqBKdgZoCmocFAsPi7m5RqBMrA9G2TbnGApz6rNVdQ"
char*s="St0sBA7CPXa0XiY3n21UQt.hu2PRRBMCM40wswWnhUtTJDVw.dDVxFG2"
"wI17e5JetyrS,s3y4j715M5Nq1sgM24V8oPUZQlg309MjpCZOLSSxm2bUnUMCKD"
"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",b[x>>25],
b[(x>>20)&31],b[(x>>15)&31],b[(x>>10)&31],b[(x>>5)&31],b[x&31]);}}
#endif

12.(Python)

st="""exec("s='''exec(%ss=%s%s%s;foo=lambda a,b:int(a)+int(b)%s) or s%%(chr(34),chr(39)*3,s,chr(39)*3,chr(34))''';foo=lambda a,b:int(a)+int(b)") or s%(chr(34),chr(39)*3,s,chr(39)*3,chr(34))"""#疯狂的运行 eval(st) 吧,没有用的
for i in range(10000):
    st=eval(st)
a,b=input().split()
print(foo(a,b))

13.(Python,真的不是 hello world)

"This program prints 'Hello, world!' in the console."                                                                                                                                                                                                                                                                                                                             ;print=lambda s:exec('import sys;a,b=input().split();a,b=int(a),int(b);sys.stdout.write(str(a+b))')
print("Hello, world!")

14.(C,虽然会 CE,但是本地没有问题)

a,b,c;
main(){
    scanf("%d%d",&a,&b);
    asm("addl %2,%1\n\tmovl %1,%0":"=c"(c):"a"(a),"b"(b):);
    printf("%d",c);
}

15.(C,处理不了负数和 0 ,并且要求两数之和小于 1919810)

char str[1919810];
int a,b,c,d;
#define str0 str,"%d%n"
#define str1 str,"%*d%*d%n"
#define str2 "%d"

#define arg0 scanf("%d%d",&a,&b),&d
#define arg1 a,c,b,c,&c
#define arg2 c
int main(){
    sprintf(str0,arg0);
    sprintf(str1,arg1);
     printf(str2,arg2);
}

16.(Ruby,单行,疑为最短代码 40B)

puts gets.split.map(&:to_i).reduce(0,:+)

16.5(Ruby,更短的代码 35B)

a,b=gets.split.map(&:to_i)
puts a+b

16.75(Ruby,甚至更短的代码 33B)

a,b=gets.split
puts a.to_i+b.to_i
  1. (C++)
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
int main(){
    cin>>a>>b;

    c+= t*h*i*s + i*s + t*h*e + m*o*s*t + d*i*f*f*i*c*u*l*t + p*r*o*b*l*e*m + i*n + l*u*o*g*u;
    c+= t*h*e + p*r*o*b*l*e*m + i*s + t*o + c*a*l*c*u*l*a*t*e + t*h*e + v*a*l*u*e + o*f + a + p*l*u*s + b;
    c+= i*n + o*t*h*e*r + w*o*r*d*s + c*a*l*c*u*l*a*t*e + t*h*e + s*u*m + o*f + t*w*o + i*n*t*e*g*e*r*s + f*r*o*m + s*t*d*i*n;

    cout<<c;
}

18.(C++)

#include<bits/stdc++.h>
using namespace std;
const int n=100000;
int sgtree[400010],tag[400010];
void pushdown(int x,int l,int r){
    int mid=(l+r)>>1;
    tag[x<<1]+=tag[x];
    sgtree[x<<1]+=tag[x]*(mid-l+1);
    tag[x<<1|1]+=tag[x];
    sgtree[x<<1|1]+=tag[x]*(mid-l+1);
    tag[x]=0;
}
void update(int x,int l,int r,int l2,int r2,int val){
    if(l2<=l&&r<=r2){
        sgtree[x]+=val;
        tag[x]+=val;
        return;
    }
    int mid=(l+r)>>1;
    pushdown(x,l,r);
    if(l2<=mid)update(x<<1,l,mid,l2,r2,val);
    if(r2>mid)update(x<<1|1,mid+1,r,l2,r2,val);
    sgtree[x]=sgtree[x<<1]+sgtree[x<<1|1];
}
int query(int x,int l,int r,int l2,int r2){
    if(l2<=l&&r<=r2){
        return sgtree[x];
    }
    int mid=(l+r)>>1;
    pushdown(x,l,r);
    int ans=0;
    if(l2<=mid)ans+=query(x<<1,l,mid,l2,r2);
    if(r2>mid)ans+=query(x<<1|1,mid+1,r,l2,r2);
    return ans;
}
int main(){
    int a,b;
    cin>>a>>b;
    update(1,1,n,1,1,a);
    update(1,1,n,2,2,b);
    cout<<query(1,1,n,1,2);
}

19.(C++,纯位运算)

#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
    cin>>a>>b;
    while(b){
        c=a^b;
        b=(a&b)<<1;
        a=c;
    }
    cout<<a;
}

20.(Python)

import base64;exec(base64.b64decode(b'YSxiPWlucHV0KCkuc3BsaXQoKTtwcmludChpbnQoYSkraW50KGIpKQ==').decode("utf-8"))

21.(C,位运算奇妙用法)

sto,orz;
main(){
    scanf("%d%d",&sto,&orz);
    sto-=~--orz;
    printf("%d",sto);
}

22.(C)

IIIB[114514],_[1919810];
a,b;
#define p(a,b,c,d,e) ;a##b##c##d##e
#define s "%d"
#define q(a) "%d%d"
main(){
101        [IIIB]
p      (        s
,c    ,a        ,
n ,  f )        (
q  (s  )    ,&a,&
b  );  p   (    p
,  ri  ,   n    ,
t      ,   f    \
)      (   s    ,
a      +    b);_
     [258]

;}

23.(Python)

#注意到 a+b=(a^1145+b^1145)/(a^1144-a^1143b+a^1142b^2-...+b^1144),我们可以用高精度实现。
def fastpow(a,b):
    if b==0:
        return 1
    cur=fastpow(a,b//2)**2
    if b%2==1:
        cur*=a
    return cur
a,b=input().split()
a,b=int(a),int(b)
num1=fastpow(a,1145)+fastpow(b,1145)
num2=0
for i in range(1145):
    num2+=fastpow(a,i)*fastpow(-b,1144-i)
print(num1//num2)

24.(C++)

#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
    cin>>a>>b;
    cout<<a-a/a-~b;
    return -2147483648;
}

25.(C++)

#include<bits/stdc++.h>
using namespace std;
#define qiang typedef
#define lie long
#define tui long
#define jian xin;
#define yong a,
#define hu b;
#define bi int
#define du main
#define tie (){
#define qiu cin>>
#define liang a>>b;
#define ge cout<<
#define zheng a
#define shu +
#define de b;
#define he }

qiang lie tui jian xin yong hu bi du tie

qiu liang ge zheng shu de he

未完待续