Qcrkkl @ 2024-09-15 15:24:11
这个题坑在哪
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
if (a<0) printf("(%I64d)",a);
else printf("%I64d",a);
printf("+");
if (b<0) printf("(%I64d)",b);
else printf("%I64d",b);
long long xyg=a+b;
if (xyg<0) printf("=(%I64d)",xyg);
else printf("=%I64d",xyg);
return 0;
}
by yao_123456 @ 2024-09-15 15:45:33
中间有个中文括号(:
by Qcrkkl @ 2024-09-15 15:50:01
@yao_123456 我改了为什么还是过不了。。qwp
by yao_123456 @ 2024-09-15 15:52:47
@Qcrkkl 题目的中间和结尾,即答案和第二个数字的左边,都有一个中文的括号
by Qcrkkl @ 2024-09-15 16:00:55
还是wa了。。
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
if (a<0) printf("(%I64d)",a);
else printf("%I64d",a);
printf("+");
if (b<0) printf("(%I64d)",b);
else printf("%I64d",b);
long long xyg=a+b;
if (xyg<0) printf("=(%I64d)",xyg);
else printf("=%I64d",xyg);
return 0;
}
by yao_123456 @ 2024-09-15 16:05:01
@Qcrkkl 我也不行(:
by wangcm @ 2024-09-15 16:05:51
@Qcrkkl 没有办法……
by wangcm @ 2024-09-15 16:06:43
这题上一次有人AC好像还是去年(上个月)……
by wangcm @ 2024-09-15 16:13:42
听取WA声一片……
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
if(a<0) cout<<"("<<a<<")";
else cout<<a;
cout<<"+";
if(b<0) cout<<"("<<b<<")";
else cout<<b;
cout<<"=";
if(a+b<0) cout<<"("<<a+b<<")";
else cout<<a+b;
return 0;
}
by wangcm @ 2024-09-15 16:31:28
已AC
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
if(a<0){
printf("%c%c",-93,-88);
cout<<a<<")";
}
else cout<<a;
cout<<"+";
if(b<0){
printf("%c%c",-93,-88);
cout<<b<<")";
}
else cout<<b;
cout<<"=";
if(a+b<0){
printf("%c%c",-93,-88);
cout<<a+b<<")";
}
else cout<<a+b;
return 0;
}
by wangcm @ 2024-09-15 16:33:52
@Qcrkkl 错误原因:中文括号占两个字节,需要分开输出。而将中文括号拆为两个ACSII值,便是-93和-88