1 条题解

  • 0
    @ 2025-4-12 21:43:14

    C++ :

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        int x1,x2,ans;
        cin>>x1>>x2;
        if(x1<x2)
        {
            ans=x1+x2;
        }
        else if(x1>x2)
        {
            ans=x1-x2;
        }
        else
        {
            //相等
            ans=x1*x2;
        }
        cout<<ans<<endl;
        return 0;
    }
    

    Pascal :

    var
      a,b,m:longint;
    begin
      readln(a,b);
      if a<b then m:=a+b;
      if a>b then m:=a-b;
      if a=b then m:=a*b;
      writeln(m);
    end.
    
    • 1

    信息

    ID
    1371
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者