SDAU 課程練習2 1002

2021-07-10 15:57:25 字數 908 閱讀 8445

f(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x

sample output

-74.4291

-178.8534

author

redow

題目大意:
給定函式和  y  值 求函式最小值。
思路:
連續求導可知導函式單調遞增,並且 f 』 (0) < 0 f '(100) > 0
那麼導函式的零點就是原函式的最小值。
二分求零點就行了。
感想:
說好的搜尋呢。。。到現在都是 二分。。。
ac**:
#include #include#include#include#include#include#include#include#include#include#include#includeusing namespace std;

double y;

double eqa1(double x)

double eqa (double x)

int main()

mid=eqa1(mid);

printf("%.4f\n",mid);

}}

SDAU課程練習2 1008

a有1數m,b來猜.b每猜一次,a就說 太大 太小 或 對了 問b猜n次可以猜到的最大數。input 第1行是整數t,表示有t組資料,下面有t行 每行乙個整數n 1 n 30 output 猜n次可以猜到的最大數 sample input 213 sample output 1 7 author z...

2016SDAU課程練習一1000

簡單題意 有400個房間 搬一次需要10分鐘。輸入 幾 組資料,房間編號 m 到 n 求最少需要多少分鐘。樣例 sample input 3 4 10 20 30 40 50 60 70 80 2 1 3 2 200 3 10 100 20 80 30 50 sample output 10 203...

2016SDAU課程練習一1006

簡單題意 只有乙個電梯。上樓需要六分鐘,下樓需要四分鐘,每一層停留五分鐘。輸入n組資料,按照特定的順序上下樓,求總共需要的時間。解題思路及形成過程 雖然放在貪心演算法的專題,但是顯然用傻瓜法更容易。感想 第一次這麼快速的解決一道題。ac include include using namespace...