DEEPSEEK乱写
2026-10-06 14:18:33
发布于:四川
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<string> o;
auto e = [&](const string& s){ o.push_back(s); };
// 读入 n1, n2, n3
e("ncall 1 S[0]");
e("ncall 1 S[1]");
e("ncall 1 S[2]");
// 读入 A 到 M[1000 ...]
e("S[3]=0");
e("S[6]=S[0]*S[1]"); // 总数 n1*n2
e("LA_read:");
e("S[14]=S[6]-S[3]");
e("if S[14] goto LA_read_body");
e("goto LA_read_end");
e("LA_read_body:");
e("S[5]=S[3]+1000");
e("ncall 1 M[S[5]]");
e("S[3]=S[3]+1");
e("goto LA_read");
e("LA_read_end:");
// 读入 B 到 M[50000 ...]
e("S[3]=0");
e("S[7]=S[1]*S[2]"); // 总数 n2*n3
e("LB_read:");
e("S[14]=S[7]-S[3]");
e("if S[14] goto LB_read_body");
e("goto LB_read_end");
e("LB_read_body:");
e("S[5]=S[3]+50000");
e("ncall 1 M[S[5]]");
e("S[3]=S[3]+1");
e("goto LB_read");
e("LB_read_end:");
// 三重循环计算 C 并输出
e("S[10]=0"); // i = 0
e("Li:");
e("S[14]=S[0]-S[10]"); // n1 - i
e("if S[14] goto Li_body");
e("goto Li_end");
e("Li_body:");
e("S[11]=0"); // k = 0
e("Lk:");
e("S[14]=S[2]-S[11]"); // n3 - k
e("if S[14] goto Lk_body");
e("goto Lk_end");
e("Lk_body:");
e("S[13]=0"); // sum = 0
e("S[12]=0"); // j = 0
e("Lj:");
e("S[14]=S[1]-S[12]"); // n2 - j
e("if S[14] goto Lj_body");
e("goto Lj_end");
e("Lj_body:");
// A[i][j] 地址 = 1000 + i*n2 + j
e("S[15]=S[10]*S[1]"); // i * n2
e("S[15]=S[15]+S[12]"); // + j
e("S[15]=S[15]+1000"); // + 基址
e("S[16]=M[S[15]]"); // A[i][j]
// B[j][k] 地址 = 50000 + j*n3 + k
e("S[17]=S[12]*S[2]"); // j * n3
e("S[17]=S[17]+S[11]"); // + k
e("S[17]=S[17]+50000"); // + 基址
e("S[18]=M[S[17]]"); // B[j][k]
// sum += A * B
e("S[19]=S[16]*S[18]");
e("S[13]=S[13]+S[19]");
e("S[12]=S[12]+1");
e("goto Lj");
e("Lj_end:");
// 输出 sum
e("ncall 2 S[13]");
e("S[11]=S[11]+1");
e("goto Lk");
e("Lk_end:");
e("S[10]=S[10]+1");
e("goto Li");
e("Li_end:");
e("exit");
for (auto& s : o) cout << s << "\n";
return 0;
}
太雷霆了这道题
这里空空如也






有帮助,赞一个