题解:P1001 A+B Problem

· · 题解

现在你遇到了一个极其困难的问题,所以你不允许使用 # { } [ ] 等符号。

那么我们将如何写出代码呢?

由题意得,我们可以使用各种其他神奇符号。

所以我们可以得出以下代码。

%:include<bits/stdc++.h>
using namespace std;
int main()<%
    int a<:4:>;
    cin>>a<:0:>>>a<:1:>;
    while(a<:1:> not_eq 0)<%
        a<:2:>=a<:0:>^a<:1:>;
        a<:3:>=(a<:0:>&a<:1:>)<<1;
        a<:0:>=a<:2:>;
        a<:1:>=a<:3:>;
    %>
    cout<<a<:0:><<endl;
%>

这些其实就是 c++ 中为了防止有些用户的键盘上没有足够的字符而定义的别名,具体如下。

这些替代标记增强了代码的可移植性和可读性,尤其在特殊字符输入受限的环境中非常有用。