QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595271 | #7747. Memory | AmiyaCast | WA | 1ms | 5888kb | C++14 | 760b | 2024-09-28 13:14:32 | 2024-09-28 13:14:33 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define pii make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,b,a) for(int i=b;i>=a;--i)
const ll inf = 1145141919810;
using namespace std;
#define double long double
const int N = 2e5 + 7;
double f[N];
int n, a[N];
const double eps = 1e-30;
int sgn(double x){
if(fabs(x) < eps) return 0;
else if(x > 0) return 1;
else return -1;
}
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
for(int i = 1; i <= n; ++i){
f[i] = f[i - 1] * 0.5 + a[i];
if(sgn(f[i]) == 0) putchar('0');
else if(sgn(f[i]) > 0) putchar('+');
else if(sgn(f[i]) < 0) putchar('-');
}
return 0;
}
/*
10
2 -1 4 -7 4 -8 3 -6 4 -7
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5888kb
input:
10 2 -1 4 -7 4 -8 3 -6 4 -7
output:
+0+-+---+-
result:
ok single line: '+0+-+---+-'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5868kb
input:
10 -1 36 18 18 18 18 18 18 18 -18
output:
-++++++++-
result:
ok single line: '-++++++++-'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
1000 -1 193552 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 967...
output:
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
result:
wrong answer 1st lines differ - expected: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-', found: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++0'