改了,但为什么还只有90分呀?????!!!!!

P1001 A+B Problem

ILIKEYSH1314 @ 2024-12-14 16:45:46

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
    cin>>a>>b;
    if(a<0&&b<0){
    long long i=0;
    while(i>a){
        i--;
    }
    long long n=0;
    while(n>b){
        n--;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a与b都小于0; 
    else if(a>0&&b<0){
    long long i=0;
    while(i<a){
        i++;
    }
    long long n=0;
    while(n>b){
        n--;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a大于0,b小于0; 
    else if(a<0&&b>0){
    long long i=0;
    while(i>a){
        i--;
    }
    long long n=0;
    while(n<b){
        n++;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a小于0, b大于0; 
    else if(a>0&&b>0){
    long long i=0;
    while(i<a){
        i++;
    }
    long long n=0;
    while(n<b){
        n++;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a与b都大于0; 
    else if(a==0&&b>0){
    long long n=0,i=0;
    while(n<b){
    n++;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a=0,b大于0; 
    else if(a==0&&b<0){
    long long n=0,i=0;
    while(n>b){
    n--;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    }
    //a=0,b小于0;
    else if(a<0&&b==0){
    long long n=0,i=0;
    while(n>a){
    n--;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    } 
    //a小于0,b=0; 
    else if(a>0&&b==0){
    long long n=0,i=0;
    while(n<a){
    n++;
    }
    long long ans;
    ans=i+n;
    cout<<ans<<endl;
    return 0;
    } 
    //a大于0,b=0; 
 }

by LG_jyc @ 2024-12-14 16:47:09

@ILIKEYSH1314

一眼a=0 b=0的没判


by cai_cai_cai @ 2024-12-14 16:53:59

有问题吧


by sunjunyi1017 @ 2024-12-14 16:54:00

a=0 b=0的没判


by hzxphy @ 2024-12-14 16:54:29

有问题吧


by Y39Y39Y39 @ 2024-12-14 17:05:10

不是,哥们


by Brilliant_kco @ 2024-12-15 13:56:09

@ILIKEYSH1314 没有必要写这么长吧? 拿到AC超简单 感觉这道题水了(bushi)

//小小AC直接拿捏好吧
//也是直接AC了好吧
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    int a,b;//定义好吧
    cin >> a >> b;//输入好吧
    cout << a+b;//直接输出好吧
    return 0;
}

by ILIKEYSH1314 @ 2024-12-15 14:16:45

@Brilliant_kco 只是装亿下


by Brilliant_kco @ 2024-12-15 14:38:18

@ILIKEYSH1314 饿


by caoen2014 @ 2024-12-17 17:11:12

你有问题吧!?


by A13229770089 @ 2024-12-22 17:24:56

你很优秀


| 下一页