QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275971#5817. 小学生数学题SordidLeaf54386Compile Error//C++14693b2023-12-05 13:19:032023-12-05 13:19:03

Judging History

你现在查看的是最新测评结果

  • [2023-12-05 13:19:03]
  • 评测
  • [2023-12-05 13:19:03]
  • 提交

answer

#include<iostream>
#include<math.h>
using namespace std;
#define int __int128
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')w=-1;
		ch=getchar();
	}
	while(ch>='0' && ch<='9')
	{
		s=(s<<3)+(s<<1)+(ch^48);
		ch=getchar();
	}
	return s*w;
}
void write(int x)
{
	if(x<0)
	{
		putchar('-'),x=-x;
	}
	if(x>9)
	{
		write(x/10);
	}
	putchar(x%10+'0');
}
int n,k;
int f(int x)
{
	if(x==1){
		return 1;
	}
	return x*f(x-1);
}
int fs(int x,int k)
{
	return f(x)/pow(x,k);
}
int ans;
signed main()
{
	n=read();
	k=read();
	for(int i=1;i<=n;i++){
		ans+=fs(i,k)%998244353;
	}
	write(ans);
	return 0;
}

详细

answer.code: In function ‘__int128 fs(__int128, __int128)’:
answer.code:43:24: error: call of overloaded ‘pow(__int128&, __int128&)’ is ambiguous
   43 |         return f(x)/pow(x,k);
      |                     ~~~^~~~~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571,
                 from /usr/include/c++/11/iostream:38,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate: ‘double pow(double, double)’
  140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
In file included from /usr/include/c++/11/math.h:36,
                 from answer.code:2:
/usr/include/c++/11/cmath:392:3: note: candidate: ‘constexpr long double std::pow(long double, long double)’
  392 |   pow(long double __x, long double __y)
      |   ^~~
/usr/include/c++/11/cmath:388:3: note: candidate: ‘constexpr float std::pow(float, float)’
  388 |   pow(float __x, float __y)
      |   ^~~