版本比较
我能通过 A+B Problem 吗?
正文
增加 107 行删除 6 行
11233456738 行未改动4647484950505251525354557 行未改动636465666867686970715 行未改动777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118283183184允许语言:C/C++。允许语言:C/C++,不允许内联汇编或 `system`。
:::::info[情景 1]### 情景 1
禁止出现关键字和 `define`。
简单。38 行未改动}```::::::::::::
:::::info[情景2 ]### 情景2禁止使用加号和减号。
```cpp#include<bits/stdc++.h>7 行未改动 cin>>a>>b; cout<<add(a,b);}```::::info[加强]::::info[加强]{open}禁止使用任何运算符。```cpp#include"stdio.h"#include"bits/stl_function.h"5 行未改动}```
备注:`'\045'` 表示 `'%'`,因为 `'%'` 的 ascii 在八进制下是 $45$。
:::error[加强]{open}不行了这个太抽象了。
禁止使用这些符号:`+-*/!%^&*. ~=<>,`。
不能使用 `scanf`/`printf`,因为 `,` 挂了。
不能使用 `cin`/`cout` 或用 `cin`/`cout` 的内置函数,因为 `<>.` 挂了。
不能使用 `plus`,因为 `,` 挂了。
那么,手写快读/快写。
`=` 挂了怎么办?
没事我们先 `a and_eq 0`,再 `a or_eq b`,表示 `a=b`。
加法怎么办?
众所周知,`[]` 的本质是指针**加法**,那么给出 [LionBlaze](https://www.luogu.com.cn/user/911054) 大佬的代码:`(long long)bitand(((decltype(std::string().c_str()))(a))[b])`。
不过 `std::string().c_str()` 太长了,且不能用 `.`,我们使用 `main(char v[])`,这时的 `v` 也是 `char*` 类型的。
~~不过这个 main 函数是不是不太对?~~
给出使用了空格代码,注意不能使用空格,头文件不能带 `.`:
```cpp#include"cstdio"#include"cctype"#include"string"int a;int b;int c;main(char v[]){ c and_eq 0; c or_eq getchar(); if(not isdigit(c)){ c and_eq 0; c or_eq getchar(); while(isdigit(c)){ int tmp(c xor 48); c and_eq 0; c or_eq std::negate()(tmp); int e((size_t)bitand(decltype(v)(a)[a])); int f((size_t)bitand(decltype(v)(e)[e])); int g((size_t)bitand(decltype(v)(f)[f])); int h((size_t)bitand(decltype(v)(e)[g])); int i((size_t)bitand(decltype(v)(h)[c])); a xor_eq i xor_eq a; c and_eq 0; c or_eq getchar(); } }else while(isdigit(c)){ c xor_eq 48; int e((size_t)bitand(decltype(v)(a)[a])); int f((size_t)bitand(decltype(v)(e)[e])); int g((size_t)bitand(decltype(v)(f)[f])); int h((size_t)bitand(decltype(v)(e)[g])); int i((size_t)bitand(decltype(v)(h)[c])); a xor_eq i xor_eq a; c and_eq 0; c or_eq getchar(); } c and_eq 0; c or_eq getchar(); if(not isdigit(c)){ c and_eq 0; c or_eq getchar(); while(isdigit(c)){ int tmp(c xor 48); c and_eq 0; c or_eq std::negate()(tmp); int e((size_t)bitand(decltype(v)(b)[b])); int f((size_t)bitand(decltype(v)(e)[e])); int g((size_t)bitand(decltype(v)(f)[f])); int h((size_t)bitand(decltype(v)(e)[g])); int i((size_t)bitand(decltype(v)(h)[c])); b xor_eq i xor_eq b; c and_eq 0; c or_eq getchar(); } }else while(isdigit(c)){ c xor_eq 48; int e((size_t)bitand(decltype(v)(b)[b])); int f((size_t)bitand(decltype(v)(e)[e])); int g((size_t)bitand(decltype(v)(f)[f])); int h((size_t)bitand(decltype(v)(e)[g])); int i((size_t)bitand(decltype(v)(h)[c])); b xor_eq i xor_eq b; c and_eq 0; c or_eq getchar(); } int ans((long long)bitand(((decltype(v))(a))[b])); for(char x:std::to_string(ans))putchar(x);}```把空格全部替换为换行即可。::::::::::::
未完待续。