40分

P1001 A+B Problem

chenyifan12 @ 2024-07-08 21:12:19

代码:```cpp

include<iostream>

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


:(

by chenyifan12 @ 2024-07-08 21:12:51

#include<iostream>
using namespace std;
int main()
{
    long double a,b;
    cin>>a>>b;
    cout<<a+b;
}

是这样。


by chenyyegg @ 2024-07-08 21:37:05

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

@chenyifan12 求关


by Quartz_Blocks @ 2024-07-09 21:45:38

你卡出科学计数法了。 @chenyifan12

顺带一提:你跟我们班同学有个同学重名


#include<iostream>
using namespace std;
int main()
{
    long double a,b;
    cin>>a>>b;
    cout<<int(a+b);
}

by chenyifan12 @ 2024-07-10 10:58:57

6


by chenyifan12 @ 2024-07-10 11:00:03

6


by are_you_sure @ 2024-07-12 17:11:37

@chenyifan12 用 int 不好吗?

#include<iostream>
using namespace std;

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

如果一定要 long double 的话,请这样写

#include<iostream>
#include <iomanip>
using namespace std;

int main(){
    long double a,b;
    cin>>a>>b;
    cout<<setprecision(0)<<fixed<<a+b;
    return 0;
}

by 15339934200J @ 2024-07-15 19:19:37


#include <stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n", a+b);
    return 0;
}

by hujiarui2014_Silver @ 2024-07-17 09:51:35

@chenyifan12

用int或1long long 或long 不行吗?

这题哪有这么nan


by 1930_ @ 2024-07-17 09:52:05

@chenyifan12 用long long不香吗?//10年OI一场空,不开ll见祖宗

#include<bits/c++config.h>
#include<iostream>
#define l2 long long
using namespace std;
l2 x;
l2 y;
int main(){
  cin>>x>>y;
  cout<<x+y;
  return 0;
}

by chenyifan12 @ 2024-07-26 16:44:07

很“难”!!!!!


|