今天打了一場牛客網的小白月賽,只做出來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
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using
namespace std;
typedef
long
long
int ll;
typedef
unsigned
long
long
int ull;
typedef pair <
int,
int> pii;
inline
intrd()
while
(isdigit
(ch)
) x =
(x <<3)
+(x <<1)
+(ch ^48)
, ch =
getchar()
;return w ?
-x : x;
}inline ll lrd()
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()
牛客小白月賽23 部分題解
e 水題簽到 include using namespace std intmain j 水題 include using namespace std int a 100005 intmain sort a,a n cout a 0 i 題意 尋找字典序最大的子串 思路 遍歷兩個for,然後把所有的...
牛客小白月賽14 部分題目總結
官方題解 sol 考慮兩個陣列a和b,a i 表示第i天在1號城市的方案數,b i 表示第i天不在1號城市的方案數,可以得到如下dp方程式 a i b i 1 b i a i 1 n 1 b i 1 n 2 a k 就是問題的答案。但是k比較大,不能暴力迴圈。可以將dp方程式轉換成矩陣來利用矩陣快速...
牛客網Wannafly挑戰賽27部分題解
number1 求完全平方數的個數 white shores,and beyond.a far green country under a swift sunrise.灰魔法師 給出長度為n的序列a,求有多少對數對 i,j 1 i j n 滿足 ai aj 為完全平方數。這個題暴力求肯定會超時。知道...