QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#643246#7747. MemoryProaesWA 0ms3644kbC++20972b2024-10-15 20:04:472024-10-15 20:04:48

Judging History

你现在查看的是最新测评结果

  • [2024-10-15 20:04:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-10-15 20:04:47]
  • 提交

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: '-+++++++++'