社区讨论

编译失败求助!!!闭关

B2129最大数 max(x,y,z)参与者 5已保存回复 7

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
7 条
当前快照
1 份
快照标识符
@mhz4igtq
此快照首次捕获于
2025/11/15 01:20
4 个月前
此快照最后确认于
2025/11/16 14:01
4 个月前
查看原帖
编译信息
CPP
编译失败
In file included from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/bits/char_traits.h:39,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/ios:40,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/istream:38,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/sstream:38,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/complex:45,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/ccomplex:39,
                 from /nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h:54,
                 from /tmp/compiler_o72nu6ph/src:1:
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/bits/stl_algobase.h: In instantiation of ‘constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]’:
/tmp/compiler_o72nu6ph/src:4:19:   required from here
/nix/store/bbmwawbq7wjb54fa35wr72alcm083d1f-luogu-gcc-9.3.0/include/c++/9.3.0/bits/stl_algobase.h:271:17: 错误:‘__comp’ cannot be used as a function
  271 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
源代码
CPP
#include<bits/stdc++.h>
using namespace std;
double x(int a,int b,int c){
	return (max(a,b,c)*1.0/(max(a+b,b,c)*max(a,b,b+c)));
}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	printf("%.3lf",x(a,b,c));
	return 0;
}

回复

7 条回复,欢迎继续交流。

正在加载回复...