20分求调

P1001 A+B Problem

b9113fced86a32cad0d8 @ 2024-08-23 09:02:57

#include<bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    __asm__ volatile(
        "movl %0, %%eax\n"
        "addl %1, %%eax\n"
        "movl %%eax, %0\n"
        :"=r"(a),"=r"(b)
    );
    cout<<a;
    return 0;
}

by DGFLSzfd @ 2024-08-23 09:10:42

#include<bits/stdc++.h>
using namespace std;
int main() {
    long long a,b;
    cin>>a>>b;
    __asm__ volatile(
        "movl %0, %%eax\n"
        "addl %1, %%eax\n"
        "movl %%eax, %0\n"
        :"=r"(a),"=r"(b)
    );
    cout<<a;
    return 0;
}

by DGFLSzfd @ 2024-08-23 09:11:38

十年OI一场空,不开 longlong 见祖宗


by b9113fced86a32cad0d8 @ 2024-08-23 09:14:34

@DGFLSzfd 开long long之后CE了


by DGFLSzfd @ 2024-08-23 09:21:49

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

by b9113fced86a32cad0d8 @ 2024-08-23 09:25:55

@DGFLSzfd 6


by HelloZheng @ 2024-08-23 09:31:16

@b9113fced86a32cad0d8 6


by jijidawang @ 2024-08-23 09:39:39

@b9113fced86a32cad0d8

#include<bits/stdc++.h>
using namespace std;
int main() {
    long long a,b;
    cin>>a>>b;
    __asm__ volatile(
        "mov %1, %%rax\n"
        "mov %2, %%rbx\n"
        "add %%rax, %%rbx\n"
        "mov %%rbx, %0\n"
        :"=r"(a) :"r"(a), "r"(b) :"%rax", "%rbx"
    );
    cout<<a;
    return 0;
}

by b9113fced86a32cad0d8 @ 2024-08-23 09:41:07

@jijidawang 谢谢,关了


by BIOSS @ 2024-08-28 10:23:37

哈?你们用的啥语言,c++不挺简单的吗?

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

by Lty2013 @ 2024-09-01 10:33:58

我的评价是,不如```c

include<bits/stdc++.h>

using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }


| 下一页