QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#656932 | #5304. Money Game | yillin | WA | 0ms | 5772kb | C++20 | 2.1kb | 2024-10-19 13:52:57 | 2024-10-19 13:53:02 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#define PII pair<int,int>
#define ull unsigned long long
//#define lson (o << 1)
//#define rson (o << 1 | 1)
#define mt ((l+r)/2)
#define lowbit(x) x & -x
#define endl '\n'
using namespace std;
using ll = long long;
inline int read(){int k=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}//getchar_unlocked()
while(c>='0'&&c<='9')k=k*10+c-'0',c=getchar();return k*f;}
template<typename T>T qpow(T a, ll n){T ans = 1; while (n){if (n & 1)ans = ans * a; n >>= 1;a = a * a;}return ans;}
int exgcd(int a,int b,int &x,int &y){if(b==0){x=1;y=0;return a;}int d=exgcd(b,a%b,y,x);y-=(a/b)*x;return d;}
template<typename T> inline void print(T x) { if (x > 9) print(x / 10); putchar(x % 10 + '0'); }
template<typename T> inline void Pr(T x, char c = '\n') { if (x < 0) putchar('-'), x = -x; print(x); putchar(c); }
inline void write(int x){if(x<0)putchar('-'),x=-x;if (x > 9) write(x / 10);putchar(x % 10 + '0');}
const int maxn = 1e6+10;
const int INF = 0x3f3f3f3f3f3f3f3f;
//const int p = 1e9 + 7;
const int N=3e5+10;
//int a[maxn],b[maxn];
//int a[N],b[N];
//const int N = 2e5 + 10;
//string s[705];
int a[N],b[N];
set<string>s;
void solve()
{
int n;
cin>>n;
double sum=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum+=a[i];
b[i]=a[i];
}
int f=1;
for(int i=1;i<=n;i++)
{
if(i==n)
{
if(b[i]!=2*b[1])
{
f=0;
//cout<<"i:"<<i<<endl;
break;
}
b[n]/=2;
b[1]+=b[n];
continue;
}
if(b[i]!=2*b[i+1])
{
f=0;
//cout<<"i"<<i<<endl;
break;
}
b[i]/=2;
b[i+1]+=b[i];
}
if(f)
{
for(int i=1;i<=n;i++)
{
cout<<b[i]<<' ';
}
cout<<endl;
return;
}
double qq=sum*1.0/n;
for(int i=1;i<=n;i++)
{
cout<<fixed<<setprecision(6)<<qq<<endl;
}
}
signed main()
{
cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
int _;
_=1;
//cin >> _;
while(_--)solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5672kb
input:
2 4 2
output:
4 2
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 5772kb
input:
2 2 3
output:
2.500000 2.500000
result:
wrong answer 1st numbers differ - expected: '3.3333333', found: '2.5000000', error = '0.2500000'