cps-j吐血
  • 板块灌水区
  • 楼主lrj3247
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/10/28 17:58
  • 上次更新2023/11/2 11:02:21
查看原帖
cps-j吐血
983702
lrj3247楼主2023/10/28 17:58

一直以为小图灵数据太强,没想到是我太弱。输出打错,痛失40分。

#include <bits/stdc++.h>
using namespace std;
long long t,m,a[5001],b[5001],c[5001],ans[5001],j,d[5001];
bool vis[5001];
int main(){
	freopen("uqe.in","r",stdin);
	freopen("uqe.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>t>>m;
	while(t--){
		j++;
		cin>>a[j]>>b[j]>>c[j];
		d[j]=b[j]*b[j]-4*a[j]*c[j];
		if(d[j]<0) vis[j]=1;
		else ans[j]=max((-1*b[j]+sqrt(d[j]))/(2*a[j]),(-1*b[j]-sqrt(d[j]))/(2*a[j]));
	}
	for(int i = 1 ; i<=j ; i++){
		if(vis[i]==0) cout<<ans[j]<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
2023/10/28 17:58
加载中...