Dropping tests Time Limit: 1000MS Memory Limit: 65536K Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be Given your test scores and a positive integer k, d
#牛顿迭代法 def sqrt1(x): y = 1.0 while abs(y * y - x) > 1e-6: y = (y + x/y)/2 return y #使用二分法 def sqrt2(x): if x > 1: a = 1.0 b = x else: a = x b = 1.0 y = (a + x)/2 while abs(y * y - x) > 1e-6: if y * y > x: b = y y = (y + a) /2 else: a = y y = (
4725传送门 4726传送门 解析 代码: #include<bits/stdc++.h> #define ri register int using namespace std; inline int read(){ int ans=0; char ch=getchar(); while(!isdigit(ch))ch=getchar(); while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar(); r
function sevnn x=[1,0]'; [x,val]=dfp('fun','gfun',x) end function f=fun(x) f=100*(x(1)^2-x(2))^2+(x(1)-1)^2; end function g=gfun(x) g=[400*x(1)*(x(1)^2-x(2))+2*(x(1)-1), -200*(x(1)^2-x(2))]'; end function He=Hess(x) He=[1200*x(1)^2-400*x(2)+2, -400*x