QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#643246 | #7747. Memory | Proaes | WA | 0ms | 3644kb | C++20 | 972b | 2024-10-15 20:04:47 | 2024-10-15 20:04:48 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n,zheng=0,xiao=0,shu=0,a;
cin>>n;
for(int i=0;i<n;i++){
cin>>a;
if(xiao == 0 && zheng%2==0){
zheng=zheng/2+a;
if(zheng>0){
cout<<"+";
}else if(zheng==0){
cout<<"0";
}else{
cout<<"-";
}
}else{
xiao=1;
zheng=zheng/2;
if(a>abs(zheng)&&a>0&&zheng<0){
zheng=zheng+a-1;
}else if(a<0&&zheng>0&&abs(a)>zheng){
zheng=zheng+a+1;
}
else{
zheng=zheng+a;
}
if(zheng>=0){
cout<<"+";
}else{
cout<<"-";
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
10 2 -1 4 -7 4 -8 3 -6 4 -7
output:
+0+-+---+-
result:
ok single line: '+0+-+---+-'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3588kb
input:
10 -1 36 18 18 18 18 18 18 18 -18
output:
-+++++++++
result:
wrong answer 1st lines differ - expected: '-++++++++-', found: '-+++++++++'