QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#682027#5304. Money GameabsabsWA 0ms3924kbC++233.1kb2024-10-27 13:34:562024-10-27 13:34:56

Judging History

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

  • [2024-10-27 13:34:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3924kb
  • [2024-10-27 13:34:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define ull unsigned long long
#define ms(x, y) memset(x, y, sizeof x);
#define debug(x) cout << #x << " = " << x << endl;
#define ios ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define fre                           \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
const int mod = 998244353;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 10;
const double esp = 1e-6;
const ull MOD1 = 1610612741;
const ull MOD2 = 805306457;
const ull BASE1 = 1331;
const ull BASE2 = 131;
#define pre(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
char *p1, *p2, buf[100000]; // 快读和同步流二者只能选一个
#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++)
int read()
{
	int x = 0, f = 1;
	char ch = nc();
	while (ch < 48 || ch > 57)
	{
		if (ch == '-')
			f = -1;
		ch = nc();
	}
	while (ch >= 48 && ch <= 57)
		x = x * 10 + ch - 48, ch = nc();
	return x * f;
}
void write(int x)
{
	if (x < 0)
		putchar('-'), x = -x;
	if (x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
	return;
}
void solve()
{
    // vector<double>wwww(1000);
    // for(int i=1;i<=1000;i++){
    //     wwww[i]=i+0.1;
    // }
    // for(int j=1;j<=10000;j++){
    //     for(int i=1;i<=1000;i++){
    //         if(i==1000){
    //             wwww[1]+=wwww[i]*0.5;
    //             wwww[i]*=0.5;
    //         }else {
    //             wwww[i+1]+=wwww[i]*0.5;
    //             wwww[i]*=0.5;
    //         }
    //     }
    // }
    // for(int i=1;i<=100;i++){
    //     cout<<fixed<<setprecision(10)<<wwww[i]<<endl<<" ";
    // }
    // return;
	int n;
    cin>>n;
    vector<int>v(n+1);
    vector<double>we(n+1);
    int sum=0;
    for(int i=1;i<=n;i++){
        cin>>v[i];
        sum+=v[i];
        we[i]=v[i];
    }
    for(int i=1;i<=n;i++){
        if(i==n){
            we[1]+=we[i]*0.5;
            we[i]*=0.5;
        }else {
            we[i+1]+=we[i]*0.5;
            we[i]*=0.5;
        }
    }
    int ok=0;
    for(int i=1;i<=n;i++){
        if(we[i]==v[i])continue;
        else {
            ok=1;
            break;
        }
    }
    if(!ok){
        for(int i=1;i<=n;i++){
            cout<<v[i]<<" ";
        }
        cout<<endl;
        return;
    }
    double x=sum*1.0/n;
    for(int i=1;i<=n;i++)cout<<fixed<<setprecision(10)<<x<<" ";
    cout<<endl;
    
}
// #define LOCAL
signed main()
{
	ios
	// fre
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	auto start = std::chrono::high_resolution_clock::now();
#endif
	
	int t = 1;
	// cin >> t;
	while (t--)
		solve();
	
#ifdef LOCAL
	auto end = std::chrono::high_resolution_clock::now();
	cout << "Execution time: "
	<< std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
	<< " ms" << '\n';
#endif
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

2
4 2

output:

4 2 

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3924kb

input:

2
2 3

output:

2.5000000000 2.5000000000 

result:

wrong answer 1st numbers differ - expected: '3.3333333', found: '2.5000000', error = '0.2500000'