虽然A了,但是还是很懵逼
查看原帖
虽然A了,但是还是很懵逼
196522
HuaJi_360楼主2021/10/22 20:59

rt,本人代码将init中的scanf用read代替了之后成立90pts,是什么问题?

#include<bits/stdc++.h>
#define ll long long
#define reg register int
#define ull unsigned long long
#define ld long double
using namespace std;
template <typename T> inline void read(T &x){
	x=0;
	char c=getchar();bool f=0;
	for(;!isdigit(c);c=getchar()){if(c=='-'){f=1;}if(c==-1){exit(0);}}
	for(;isdigit(c);c=getchar()){x=(x<<1)+(x<<3)+c-'0';}
	if(f){x=-x;}
}
template<typename T> inline void write(T x){
	char F[200];
	register T cnt=0,tmp=x>0?x:-x;
	if(tmp==0){putchar('0');return;}
	if(x<0){putchar('-');}
	while(tmp>0){
		F[cnt++]=tmp%10+'0';
		tmp/=10;
	}
	while(cnt>0){putchar(F[--cnt]);}
}
unsigned int sd;
int op;
inline void init(){
	scanf("%u %d",&sd,&op);
}
inline unsigned int uint_rand(){
	sd^=sd<<13;
	sd^=sd>>7;
	sd^=sd<<11;
	return sd;
}
inline double get_n(){
	double x=(double)(uint_rand()%100000)/100000;
	return x+4;
}
inline double get_k() {
	double x=(double)(uint_rand()%100000)/100000;
	return (x+1)*5;
}
inline void read(double &n,double &a,double &b){
	n=get_n();
	a=get_k();
	if(op)b=a;
	else b=get_k();
}
int T;
double n,a,b,k,ans;
int main(){
	read(T);
	init();
	while(T--){
		read(n,a,b);
		k=a*pow(n,a-1)+b*pow(n,b-1);
		ans+=0.999999999/k;
	}
	cout<<setiosflags(ios::fixed)<<setprecision(5)<<ans;
	return 0;
}

2021/10/22 20:59
加载中...