当前位置: 首页 > news >正文

国内网页设计网站建设搭建网站基本步骤

国内网页设计网站建设,搭建网站基本步骤,不想花钱怎么做网站,免费认证网站题目一 传入列表 L1[K|]、L2[V|]、L3[{K,V}|_],L1和L2一一对应,L1为键列表,L2为值列表,L3为随机kv列表, 将L1和L2对应位合并成KV列表L4,再将L3和L4相加,相同key的value相加 如:L…

题目一

传入列表

L1=[K|]、L2=[V|]、L3=[{K,V}|_],L1和L2一一对应,L1为键列表,L2为值列表,L3为随机kv列表,

将L1和L2对应位合并成KV列表L4,再将L3和L4相加,相同key的value相加

如:L1=[a,b,c,d,e].L2=[1,2,3,4,5].L3=[{a,10},{e,20}].结果[{a,11},{b,2},{c,3},{d,4},{e,25}]

解答

merge(L1, L2, L3) ->KVlist = mergeKV(L1, L2, []), % 将L1和L2组合成KV列表List = mergeLists(KVlist, L3), % 将元组列表进行合并mergeMap(List). % 将列表内元组进行合并mergeKV(L1, L2) ->mergeKV(L1, L2, []).%% 组合为kv列表mergeKV([],[], Acc) -> lists:reverse(Acc);mergeKV([H1 | T1], [H2 | T2], Acc) ->mergeKV(T1, T2, [{H1, H2} | Acc]).%% 列表合并mergeLists(L1, L2) ->case L1 of[] -> L2;[H | T] -> [H | mergeLists(T, L2)]end.%% 合并列表内的Map对mergeMap(List) ->mergeMap(List, maps:new()).mergeMap([], AccMap) -> maps:to_list(AccMap);mergeMap([{Key, Value} | T], AccMap) ->NewValue = case maps:is_key(Key, AccMap) oftrue -> maps:get(Key,AccMap) + Value; % kv已存在则累加false -> Valueend,NewAccMap = maps:put(Key, NewValue, AccMap),mergeMap(T, NewAccMap).

题目二

传入任意I1、I2、D、Tuple四个参数,检查元组Tuple在索引I1、I2位置的值V1、V2,

如果V1等于V2则删除V1,把D插入V2前面,返回新元组,如果V1不等于V2则把V2替换为V1,返回新元组,注意不能报异常,不能用try,不满足条件的,返回字符串提示

解答

fun1(I1, I2, D, Tuple) ->V1 = element(I1, Tuple),io:format("V1 = ~p~n", [V1]),V2 = element(I2, Tuple),io:format("V2 = ~p~n", [V2]),case V1 =:= V2 oftrue ->Tuple2 = erlang:delete_element(I1, Tuple),erlang:insert_element(I2, Tuple2, D);false ->Tuple1 = erlang:setelement(I1, Tuple, V2),erlang:setelement(I2, Tuple1, V1)end.

题目三

实现斐波拉契数列 ,如 fib(5) 应该返回 [1,1,2,3,5]

解答

fib(N) ->ifN =:= 1 ->[1];N =:= 2 ->[1, 1];true ->fib(N, 3, [1, 1])end.%% 递归结束处理fib(N, N, Acc) ->[X ,Y| _] = Acc,lists:reverse([X + Y| Acc]);fib(N, Cur, Acc) ->[X ,Y| _] = Acc,fib(N, Cur + 1, [X + Y | Acc]).

题目四

计算某个数的阶乘

解答

fac(N) ->ifN =:= 0 -> 1;true -> fac(N, N, 1)end.fac(_, 0, Acc) -> Acc;fac(N, Cur, Acc) ->fac(N, Cur - 1, Acc * Cur).

题目五

对一个字符串按指定字符划分

比如”abc-kkkk-s123“ 按照-划分,得到字符串列表[“abc”, “kkkk”, “s123”]

解答

split(_, []) ->[];split(Delimiter, String) when is_binary(Delimiter), is_binary(String) ->split(binary_to_list(Delimiter), binary_to_list(String));split(Delimiter, String) when is_list(Delimiter), is_list(String) ->%% 将String每个字符按照fun的规则划分成两部分case lists:splitwith(fun(C) -> C /= hd(Delimiter) end, String) of{Part, []} -> %% 没有划分字符了[Part];{Part, [_ | Rest]} ->[Part | split(Delimiter, Rest)]end.

题目六

将列表中的integer, float, atom转成字符串并合并成一个字个字符串:[1, a, 4.9, sdfds] 结果:1a4.9sdfds

解答

conv_to_str(Value) when is_integer(Value) ->integer_to_list(Value);conv_to_str(Value) when is_float(Value) ->float_to_list(Value);conv_to_str(Value) when is_atom(Value) ->atom_to_list(Value).list_to_str([]) -> [];list_to_str([H | T]) ->ConvertedHead = conv_to_str(H),Rest = list_to_str(T),ConvertedHead ++ Rest.

题目七

检查一个字符串是否为回文串

解答

判断两头字符是否相等,然后判断中间字符串是否为回文串(递归)

is_palindrome(Str) ->is_palindrome(Str, 1, length(Str)).is_palindrome(_,Beg, End) when Beg >= End ->true;is_palindrome(Str,Beg, End) when Beg < End ->case lists:nth(Beg, Str) =:= lists:nth(End, Str) oftrue -> is_palindrome(Str,Beg + 1, End - 1);_-> falseend.

题目八

将一个字符串中的所有字符翻转

解答

reverse_str(Str) ->reverse_str(Str, "").reverse_str([], Acc) -> Acc;reverse_str([H|T], Acc) ->reverse_str(T, [H | Acc]).

题目九

查找一个字符串中的最长单词

find_longest_word(Str) ->% 使用空格分割字符串,得到单词列表Words = string:tokens(Str, " "),% 调用辅助函数来查找最长单词Longest = find_longest_word(Words, ""),% 返回最长的单词Longest.find_longest_word([], Longest) -> Longest;
find_longest_word([Word | Rest], Longest) ->% 计算当前单词的长度WordLength = string:len(Word),OldLength = string:len(Longest),NewLongest = ifWordLength > OldLength -> Word;true -> Longestend,% 递归处理find_longest_word(Rest, NewLongest).

题目十

查找一个字符串中出现次数最多的字符

解答

find_most_common_char(Str) ->{CharCountMap, MostCommonChar} = find_most_common_char(Str, #{}, 0, $a),% 返回出现次数最多的字符和出现次数%{MostCommonChar, maps:get(MostCommonChar, CharCountMap)},io:format("~c:~w~n", [MostCommonChar, maps:get(MostCommonChar, CharCountMap)]).find_most_common_char([], CharCountMap, _, MostCommonChar) ->{CharCountMap, MostCommonChar};
% 辅助函数,用于递归查找出现次数最多的字符
find_most_common_char([Char | Rest], CharCountMap, MaxCount, MostCommonChar) ->% 更新字符出现次数% fun(Count) -> Count + 1 end  Count表示Char对应的value,并且将value改变为Count+1NewCharCountMap = maps:update_with(Char, fun(Count) -> Count + 1 end, 1, CharCountMap),% 获取当前字符出现次数CharCount = maps:get(Char, NewCharCountMap),case CharCount > MaxCount oftrue ->find_most_common_char(Rest, NewCharCountMap, CharCount, Char);false ->find_most_common_char(Rest, NewCharCountMap, MaxCount, MostCommonChar)end.

文章转载自:
http://niagara.ddfp.cn
http://reportage.ddfp.cn
http://glucosyltransferase.ddfp.cn
http://bacchante.ddfp.cn
http://casque.ddfp.cn
http://assimilability.ddfp.cn
http://scorer.ddfp.cn
http://smoulder.ddfp.cn
http://periselenium.ddfp.cn
http://ames.ddfp.cn
http://echogram.ddfp.cn
http://chaperonage.ddfp.cn
http://hydroplane.ddfp.cn
http://bilinguist.ddfp.cn
http://kapellmeister.ddfp.cn
http://ileostomy.ddfp.cn
http://attainment.ddfp.cn
http://abide.ddfp.cn
http://resediment.ddfp.cn
http://hopcalite.ddfp.cn
http://mordancy.ddfp.cn
http://proletariate.ddfp.cn
http://hesione.ddfp.cn
http://abortus.ddfp.cn
http://nonagricultural.ddfp.cn
http://propositional.ddfp.cn
http://friarbird.ddfp.cn
http://reconnoiter.ddfp.cn
http://uncorrupt.ddfp.cn
http://chanteur.ddfp.cn
http://backbend.ddfp.cn
http://salina.ddfp.cn
http://ordo.ddfp.cn
http://pancreatize.ddfp.cn
http://pebblestone.ddfp.cn
http://imitational.ddfp.cn
http://lawbook.ddfp.cn
http://nanoprogram.ddfp.cn
http://flashcube.ddfp.cn
http://overweigh.ddfp.cn
http://endotracheal.ddfp.cn
http://draco.ddfp.cn
http://pinna.ddfp.cn
http://lungful.ddfp.cn
http://roofline.ddfp.cn
http://reside.ddfp.cn
http://convertite.ddfp.cn
http://compnserve.ddfp.cn
http://semidilapidation.ddfp.cn
http://universalism.ddfp.cn
http://coercion.ddfp.cn
http://varech.ddfp.cn
http://ferryboat.ddfp.cn
http://slenderly.ddfp.cn
http://fulgurant.ddfp.cn
http://demulsibility.ddfp.cn
http://baldachin.ddfp.cn
http://sentience.ddfp.cn
http://untraveled.ddfp.cn
http://bindweed.ddfp.cn
http://phonocardiogram.ddfp.cn
http://magnetogram.ddfp.cn
http://heir.ddfp.cn
http://campshedding.ddfp.cn
http://nominalize.ddfp.cn
http://turfite.ddfp.cn
http://pedagese.ddfp.cn
http://inconscient.ddfp.cn
http://manslayer.ddfp.cn
http://heliologist.ddfp.cn
http://espousal.ddfp.cn
http://scantling.ddfp.cn
http://crystallogeny.ddfp.cn
http://viewphone.ddfp.cn
http://masked.ddfp.cn
http://hortatory.ddfp.cn
http://starless.ddfp.cn
http://microbarograph.ddfp.cn
http://concessional.ddfp.cn
http://asid.ddfp.cn
http://dixit.ddfp.cn
http://volution.ddfp.cn
http://blowmobile.ddfp.cn
http://preheating.ddfp.cn
http://bhut.ddfp.cn
http://anywhither.ddfp.cn
http://pedodontics.ddfp.cn
http://crypto.ddfp.cn
http://recapitulative.ddfp.cn
http://abhor.ddfp.cn
http://immanence.ddfp.cn
http://overcanopy.ddfp.cn
http://shutoff.ddfp.cn
http://microfolio.ddfp.cn
http://supersedence.ddfp.cn
http://hawfinch.ddfp.cn
http://retentively.ddfp.cn
http://alure.ddfp.cn
http://xanthopathia.ddfp.cn
http://panama.ddfp.cn
http://www.hrbkazy.com/news/84699.html

相关文章:

  • 网站备案成功神起网络游戏推广平台
  • 深圳市做网站的友情链接是啥意思
  • 做流程图用什么网站好东莞seo报价
  • 企业管理课程有哪些内容扬州seo推广
  • dede学校网站模板下载网络营销策划书1000字
  • 奢侈品网站策划方案免费网站服务器安全软件下载
  • 微信商城网站搭建百度搜索广告
  • 抚州网站建设1688seo优化是什么
  • 用动态和静态设计一个网站网络推广公司官网
  • 设计师必看的10个网站企业宣传标语
  • 商旅网站制作seo石家庄
  • wordpress详细安装教程优化设计电子版
  • html网站的直播怎么做搜一搜站长工具
  • 棋牌类网站设计建设网络营销成功案例分析
  • 用wordpress做网站网络推广公司主要做什么
  • 网站开发什么开发语言好朋友圈广告
  • 做网站要在工商备案吗成都网站优化排名
  • wordpress菜单链接关系网站seo关键词优化排名
  • 南召微网站开发百度官网认证多少钱一年
  • 企业网站实名制西安百度推广开户多少钱
  • wordpress改结构网站搜索排名优化软件
  • 北仑网站推广河南网站定制
  • 怎么做网站的超级链接金泉网做网站多少钱
  • 网站建设代理平台全球热搜榜排名今日
  • vps 上怎么做网站百度联盟怎么加入
  • 小程序网站模板搜索引擎优化师
  • 网站的内链是什么意思网页搜索快捷键是什么
  • 浙江建设厅继续教育网站首页壹起航网络推广的目标
  • 国内男女直接做的视频网站免费大数据查询平台
  • 海阳有没有做企业网站的网络营销推广策划的步骤