CSES - Datatähti 2024 alku - Results
Submission details
Task:Säähavainnot
Sender:maweiyin24562
Submission time:2023-11-12 23:45:32 +0200
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:33:43: error: invalid types 'double[int]' for array subscript
   33 |                 double df=a[0]-a[23]-b[id][0];
      |                                           ^
input/code.cpp:17:24: warning: unused variable 'minerr' [-Wunused-variable]
   17 |                 double minerr=9999.9;
      |                        ^~~~~~
input/code.cpp:29:24: warning: unused variable 'err' [-Wunused-variable]
   29 |                 double err=0;
      |                        ^~~

Code

#include<bits/stdc++.h>
using namespace std;

double b[12]={
    -0.1,-0.1,-0.1,-0.1,-0.1,-0.1,0,0.1,0,0.1,0.1,0.1,
};
double bb[12]={
    -1,-1,-1,-1,-1,-1,0,1,0,1,1,1,
};
 
double a[25],diff[25];
int n;
 
int main(){
	cin>>n;
	while(n--){
		double minerr=9999.9;		
		for(int i=0;i<24;i++){
			cin>>a[i];
		}
		double avrdf=0;
		for(int i=0;i<23;i++){
			diff[i]=a[i+1]-a[i];
			avrdf+=diff[i];
		}
		avrdf/=23;
		
		
		double err=0;
		int id;
		
		
		double df=a[0]-a[23]-b[id][0];
		double x=df;
		for(int i=0;i<12;i++){
			x+=(b[i]*6+diff[i])/7;
			if(x-a[i]>2.2){
				cout<<"? ";
				continue;
			}
			cout<<x<<" ";
		}
		cout<<endl;
	}
}