其他分享
首页 > 其他分享> > Squares and Cubes CodeForces - 1619B

Squares and Cubes CodeForces - 1619B

作者:互联网

题目链接:Squares and Cubes

cbrt()函数是cmath标头的库函数,用于查找给定数字的立方根 ,它接受数字并返回立方根

#include<stdio.h>
#include<math.h>
#include<map>
#include<algorithm>
using namespace std;
map<long long ,int >sum;
const int maxn=1e9+5;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int x;
		scanf("%d",&x);
		int x1,y1;
		x1=(int)sqrt(x);
		y1=(int)cbrt(x);
		printf("%d\n",x1+y1-(int)(sqrt(cbrt(x))));
	}
}

标签:Squares,int,cbrt,x1,CodeForces,1619B,立方根,y1,include
来源: https://blog.csdn.net/weixin_52513845/article/details/122116259