
华为机试题
cipher_worker
https://files.pythonhosted.org/packages/58/5f/f592b07d0f04504bf4a48dfa6bbd9fcaa8591169513f845908caf3e8c9f8/SimpleITK-1.2.3-cp37-cp37m-manylinux1_x86_64.whl
展开
-
求平方根或立方根
1.求平方根:命f(x) = x^2- a,求解f(x) = x^2- a = 0。利用泰勒公式展开,即f(x)在xo处的函数值为:f(x) = f(xo) +f'(xo)(x-xo) = xo^2-a+2xo(x-x0) = 0,解之得:x = (x+a/xo) / 2。#include <math.h>double sqr(double a){ d...原创 2019-03-06 19:41:21 · 1074 阅读 · 0 评论 -
四则运算
输入描述:输入一个算术表达式输出描述:得到计算结果示例1输入3+2*{1+2*[-4/(8-6)+7]}输出251.运算符的优先级: 在运算过程中,任意两个前后相继出现的运算符的优先关系如下表所示:运算符之间的优先关系 + - * / ( ) [ ] { } @ ...原创 2019-03-21 13:52:51 · 1026 阅读 · 0 评论 -
Redraiment的走法
最长递增子序列,动态规划解法:设表示的最长递增子序列的长度。#include <stdio.h>#include <string.h>int LIS(int a[], int n) { int longest[50005]; for(int i = 0; i < n; i++) longest[i] = 1; ...原创 2019-03-21 14:45:55 · 777 阅读 · 0 评论