lz 并不想问正解
为啥下面代码第一个测试点过了:
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int t,m;
cin >> t >> m;
for (int _=0;_<t;++_){
int a,b,c;
cin >> a >> b >> c;
double d=b*b-4*a*c;
if (d<0){
cout<<"NO\n";
}else{
int x=(-b+sqrt(d))/(2*a);//yuanshenyyds
cout<<x<<endl;
}
}
return 0;
}
又为啥下面一个测试点都不能过:
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int t,m;
cin >> t >> m;
for (int _=0;_<t;++_){
int a,b,c;
cin >> a >> b >> c;
double d=b*b-4*a*c;
if (d<0){
cout<<"NO\n";
}else{
double x=(-b+sqrt(d))/(2*a);//yuanshenyyds
cout<<x<<endl;
}
}
return 0;
}
在我标记 yuanshenyyds 的地方类型发生了改变,为啥 int 能过,第一个测试点非要整除吗