QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#593654#8242. V-DiagramabsabsWA 149ms3920kbC++231.3kb2024-09-27 15:22:172024-09-27 15:22:17

Judging History

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

  • [2024-09-27 15:22:17]
  • 评测
  • 测评结果:WA
  • 用时:149ms
  • 内存:3920kb
  • [2024-09-27 15:22:17]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define debug(x) cout << #x << "=" << x << endl
//using i128 = __int128_t;
//#define int long long
typedef pair<int,int> PII;
typedef long long ll;
inline void read(int &x){
    char ch=getchar();int f=1;x=0;
    while(!isdigit(ch) && ch^'-') ch=getchar();
    if(ch=='-') f=-1,ch=getchar();
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    x*=f;
}
void write(int x){
    if(x<0)
    putchar('-'),x=-x;
    if(x>9)
    write(x/10);
    putchar(x%10+'0');
    return;
}
int n;
void rCL(){
	cin>>n;

    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    int flag=0;
    int sum=0;
    double res=0.0;
    for(int i=1;i<=n;i++){
    	sum+=a[i];
    		// sum=0;
    		// int l=i;
    		// while(a[i+1]<a[i]&&i+1<=n){
    		// 	sum+=a[i];
    		// 	i++;
    		// }
    		// while(a[i+1]>a[i]&&i+1<=n){
    		// 	sum+=a[i];
    		// 	i++;
    		// }
    		// cout<<sum<<' '<<endl;
    		// int r=i;
    		// cout<<l<<' '<<r<<endl;
    		// res=max(res,1.0*sum/(r-l+1));
    	
    }
    res=1.0*sum/n;
    printf("%.20lf\n",res );

}
signed main(){
   /* ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);*/
    int O_o;
    cin>>O_o;
    while(O_o--){
        rCL();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4
8 2 7 10
6
9 6 5 3 4 8

output:

6.75000000000000000000
5.83333333333333303727

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 149ms
memory: 3880kb

input:

100000
3
948511478 739365502 813471668
3
881046825 27458122 398507422
3
987554257 399092415 924260278
3
984128569 125199021 716360525
3
529589236 45783262 313507287
3
645443456 85994112 226010681
3
914820717 228360911 572267310
3
418958362 56703604 195276041
3
64461646 26764720 26995581
3
914535039 ...

output:

-597872882.66666662693023681641
435670789.66666668653488159180
-661353448.66666662693023681641
608562705.00000000000000000000
296293261.66666668653488159180
319149416.33333331346511840820
571816312.66666662693023681641
223646002.33333334326744079590
39407315.66666666418313980103
383253737.6666666865...

result:

wrong answer 1st numbers differ - expected: '833782882.6666666', found: '-597872882.6666666', error = '1.7170606'