|
50鱼币
本帖最后由 陈尚涵 于 2023-8-27 13:07 编辑
rt,我写了一段抽象代码
想拿到这50育碧,需要写出这段抽象代码的正常形式
举个栗子,比如说给你这样一段只有一点点点点点点抽象的抽象代码:
- #include <iostream>
- using namespace std;
- int p(int a, int b){
- return a - b;
- }
- int main(){
- int a, b, c;
- cin >> a >> b;
- c = p(p(a, b)+b, (p(b,a)+a)*-1);
- cout << c;
- return 0;
- }
复制代码
我们不难发现,这个
- p(p(a, b)+b, (p(b,a)+a)*-1)
复制代码
可以变成
经过一系列计算就会变成
你要做的就是写出这段代码的正常形式(意思对即可),比如酱紫:
- #include <iostream>
- using namespace std;
- int main(){
- int a, b;
- cin >> a >> b;
- cout << a + b;
- return 0;
- }
复制代码
btw,这个是不可能当主题的,因为说你直接运行一下程序,就知道了啊,真正的肯定不会让你运行一下就知道的
放抽象代码
- #include <iostream>
- #define AwA 114514
- using namespace std;
- struct ZunDuJiaDu{
- int o;
- }O;
- int main(){
- int a, b, c, d, e, f=2;
- cin >> a;
- b = 1;
- d = AwA;
- while (b <= f){
- c = 1;
- if ((d ^ AwA) != 0){
- e = d;
- }
- d = 0;
- while (c <= a){
- cin >> O.o;
- d = d + O.o;
- c = c + 1;
- }
- b = b + 1;
- }
- if ((e ^ d) == 0){
- cout << "Destruction 321" << endl;
- } else {
- O.o = e;
- d = e;
- e = O.o;
- }
- if ((e ^ d) == 0){
- cout << "Distorted Fate" << endl;
- } else {
- cout << "Retribution" << endl;
- }
- return 0;
- }
复制代码
@tommyyu @学习编程中的Ben @高山 @liuhongrun2022 @zhangjinxuan @编程追风梦
- #include <iostream>
- using namespace std;
- int main(){
- int n, sum[3] = {}, tmp;
- cin >> n;
- for (int i = 1; i <= 2; ++i) {
- for (int j = 1; j <= n; ++j) {
- cin >> tmp;
- sum[i] += tmp;
- }
- }
- if (sum[1] == sum[2]){
- cout << "Destruction 321" << endl;
- }
- cout << "Distorted Fate" << endl;
- return 0;
- }
复制代码
|
|