牛客小白月赛27部分题解(持续更新)

今天打了一场牛客网的小白月赛,只做出来3题,自己好菜,怎么办呢,只能记录下来,用以砥砺自己,多刷题。QAQ
比赛连接:连接

首先是E题

E-使徒袭来
题目描述

神秘的使徒袭击了第三新东京市,少男少女们驾驶着决战兵器EVA守护着人类的和平。
牛可乐是NERV特务机关的指挥官,他必须时刻了解牛牛/牛妹/牛能三人的战斗状态。现在牛可乐获得了这三位EVA驾驶员的战斗力之积,在保证三位驾驶员战斗力均为正实数的情况下,请你帮助牛可乐计算这三位驾驶员的战斗力之和最低是多少?

输入描述:

一个正整数n,表示三位驾驶员的战斗力之积,n≤10 ^ 9

输出描述:

输出三位驾驶员最低的战斗力之和,保留3位小数。

示例1
输入
1
输出
3.000

这道题大致意思给你一个数n,n=a * b * c,让你去算m=a+b+c,m最小的时候是多少。
这道题我一开始就是想到平方,n= a * b,m=a+b最小的时候,a是等于b的。所以我在想立方的时候m最小的时候应该也是a=b=c,那么就是算n的立方根*3
就可以了。
代码如下:

#include<algorithm>
#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<string>
#include<cmath>
#include<sstream>
#include<cstring>
#include<set>
#include<iomanip>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int, int> pii;
inline int rd() {
	int X = 0, w = 0;char ch = 0;while (!isdigit(ch)) { w |= ch == '-';ch = getchar(); }
	while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();return w ? -X : X;
}
inline ll lrd() {
	ll X = 0, w = 0;char ch = 0;while (!isdigit(ch)) { w |= ch == '-';ch = getchar(); }
	while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();return w ? -X : X;
}
#define bug  puts("DEBUG*******************************")
#define in(a) int n = rd()
#define pi acos(-1)
#define pb push_back
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,a,n) for(int i=a;i>=n;--i)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld %lld",&n,&m)
#define pd(n) printf("%d\n",n)
#define pld(n) printf("%lld\n",n)
#define mem(a,b) memset(a,b,sizeof a)
#define Case(T) int T=rd();while (T--)
#pragma comment(linker, "/STACK:102400000,102400000")
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const double E=exp(1);
const int maxn=1e7+10;
char s1[maxn];

int main()
{
    double a, b;
    cin >> a;
    b=cbrt(a);
    cout <<setiosflags(ios::fixed)<< setprecision(3) << b*3 << endl;
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值