machine learning exercises

Learn about machine learning exercises, we have the largest and most updated machine learning exercises information on alibabacloud.com

[Huawei Machine Test exercises] 44.24-point game algorithm

TopicNote: 6 + 2 * 4 + 10 = 24 is not a number calculation of a numberCode/* ---------------------------------------* Date: 2015-07-03* sjf0115* title: 24 Points Game algorithm * Source: Huawei Machine Test Exercises--------------------- --------------------*/#include #include #include #include using namespace STD;//iterative simulation of various combinationsvoidHelper vectorint>num,intIndexintResultBOOLis

[Huawei Machine Test exercises]37. Chorus Team

TopicDescribe:计算最少出列多少位同学,使得剩下的同学排成合唱队形说明:N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队形。 合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2…,K,他们的身高分别为T1,T2,…,TK, 则他们的身高满足存在i(1Topic Category:循环 Difficulty:初级 Run time limit:Memory Limit:Stage:入职前练习 Input:整数N一行整数,空格隔开,N位同学身高Output:最少需要几位同学出列Sample input:8186 186 150 200 160 130 197 200Sample output:4Code/* ---------------------------------------* Date: 2015-07-02* sjf0115* title: Chorus * Source: Huawei Machine Test

[Huawei Machine Test exercises]34. Identify valid IP addresses and masks and classify statistics

TopicDescribe:请解析IP地址和对应的掩码,进行分类识别。要求按照A/B/C/D/E类地址归类,不合法的地址和掩码单独归类。所有的IP地址划分为 A,B,C,D,E五类A类地址1.0.0.0~126.255.255.255; B类地址128.0.0.0~191.255.255.255; C类地址192.0.0.0~223.255.255.255; D类地址224.0.0.0~239.255.255.255; E类地址240.0.0.0~255.255.255.255 私网IP范围是: 10.0.0.0~10.255.255.255172.16.0.0~172.31.255.255 192.168.0.0~192.168.255.255 子网掩码为前面是连续的1,然后全是0Topic Category:字符串 Difficulty: 中级 Run time limit: Memory Limit: Stage:入职前练习 Input:多行字符串。每行一个IP地址和掩码,已~隔开。如:10.70.44.68~255.254.255.01.0.0.1~2

[Huawei Machine Test exercises]48. Armstrong number

TopicDescribe:如果一个正整数等于其各个数字的立方和,则该数称为阿姆斯特朗数(亦称为自恋性数),1除外,如407 = 43+03+73就是一个阿姆斯特朗数。试编程求n(n ≤ 65536)以内的所有阿姆斯特朗数。Interface descriptionPrototype:int CalcArmstrongNumber(int n);Input parameters:int n: n ≤ 65536return value: n以内的阿姆斯特朗数的数量Practice Stage:Code/* ---------------------------------------* Date: 2015-07-04* sjf0115* title: Armstrong number * Source: Huawei Machine Test Exercises---------------------

[Huawei Machine Test exercises]46. To calculate the number of 0 of binary numbers

TopicDescribe:输入一个10进制数字,请计算该数字对应二进制中0的个数,注意左数第一个1之前的所有0都不需要计算。不需要考虑负数的情况。Topic Category:Difficulty:Run time limit:无限制Memory Limit:无限制Stage:Input:要计算的十进制非负数Output:二进制中第一个1之后0 的个数Sample input:2Sample output:1Code/* ---------------------------------------* Date: 2015-07-03* sjf0115* title: Count the number of 0 of binary numbers * Source: Huawei Machine Test Exercises----------------- ------------------------

[Huawei Machine Test exercises]49. Inserting a node into an ascending one-way list

TopicDescribe:输入一个升序单向链表和一个链表节点,向单向链表中按升序插入这个节点。输入为空指针的情况视为异常,另外不考虑节点值相等的情况。链表结点定义如下:struct ListNode{ int m_nKey; ListNode* m_pNext;};详细描述:Interface descriptionPrototype:ListNode* InsertNodeToList(ListNode* pListHead, ListNode* pInsertNode);Input parameters: ListNode* pListHead 单向链表 ListNode* pInsertNode 新插入节点Output parameters (the memory area pointed to by the pointer is guaranteed to be valid):ListNode* pListHead 单向链表return value:正常插入节点返回链表头指针,其它异常返回空指针Practice Stage:Code/* -

[Huawei Machine Test exercises]50. The last three digits of the n-th side of M

TopicDescribe:正整数M 的N次方有可能是一个非常大的数字,我们只求该数字的最后三位例1:比如输入5和3 ,5的3次方为125,则输出为125 例2:比如输入2和10 2的10次方为1024 ,则输出结果为24例3:比如输入111和5 111的5次方为116850581551,则输出结果为551Practice Stage:Code/* ---------------------------------------* Date: 2015-07-04* sjf0115* title: The last three bits of the n-th side of M * Source: Huawei Machine Test Exercises----------------- ------------------------*/#include #include "oj.h"using na

[Huawei Machine Test exercises]54. Determine whether the IP addresses of any two computers belong to the same subnet

: Determine whether the IP addresses of any two computers belong to the same subnet * Source: Huawei Machine Test exercises---- -------------------------------------*/#include #include "OJ.h"#include #include using namespace STD;/* Function: Determine the IP address of the two computers is the same subnet. Prototype: int issamesubnetwork (char * pcIp1, char * pcIp2, char * pcsubnetworkmask); input parameter

[Huawei Machine Test exercises]24. Delete duplicate nodes in a linked list, reverse output of remaining nodes

Topic描述: 题目描述:输入一个不带头节点的单向链表(链表的节点数小于100),删除链表中内容重复的节点(重复的节点全部删除),剩余的节点逆序倒排。要求实现函数: void vChanProcess(strNode * pstrIn,strNode * pstrOut);【输入】 pstrIn:输入一个不带头节点的单向链表【输出】 pstrOut:删除内容重复的节点(重复的节点全部删除),剩余节点逆序输出(不带头节点,链表第一个节点的内存已经申请)。【注意】只需要完成该函数功能算法,中间不需要有任何IO的输入输出示例 输入链表的内容依次为 6,7,8,8,9,10,6则输出链表的内容依次应该是 10,9,7练习阶段: Code/* ---------------------------------------* Date: 2015-06-31* sjf0115* title: Delete duplicate nodes in the list, reverse output from the remaining nodes * Source: Huawei

[Huawei Machine Test exercises]56. To find the largest and most sub-arrays

TopicDescriptive narrative:输入一个整形数组。数组中连续的一个或多个整数组成一个子数组,每一个子数组都有一个和。求全部子数组的和的最大值。InterfaceInt GetSubArraySum(Int* pIntArray,Int nCount);Specifications要求时间复杂度为O(n)Example比如输入的数组为1, -2, 3, 10, -4, 7, 2, -5,和最大的子数组为3, 10, -4, 7, 2,因此输出为该子数组的和18Practice Stage:Code/* ---------------------------------------* Date: 2015-07-05* sjf0115* title: The maximum and * source of the Subarray: Huawei Machine Test Exercises

C # Encapsulation and Class properties classroom on-machine exercises

50 million 2, test the class, the attempt price is 1 billion yuan error? Classroom Task Three: Declaration and use of methods Time: 12 minutes Requirements: in front of car cars, use the method showcarinfo to display information for each field. Step: 1, write a method showcarinfo in the class car, and messagebox.show the information of each field in the method, no return value is required. 2, add a button, call Showcarinfo display information in its Click event, 3, test the method is

[Huawei on-machine exercises] 9. Coordinate movement

-29* sjf0115* title: Coordinate movement * Source: Huawei on-Machine--------------------------- --------------*/#include #include #include using namespace STD;voidPointmove (stringStrintx,inty) {intSize = Str.size ();if(Size = =0){return; }//if vectorstring>VecintStart =0, end =0;//To extract the contents of two semicolons while(End! =-1) {end = Str.find (";", start); Vec.push_back (Str.substr (Start,end-start)); Start = end+1; }//while

[Huawei Machine Test exercises]15. Delete duplicate characters/delete duplicate strings

Topic题目标题:删除重复字符给定一个字符串,将字符串中所有和前面重复多余的字符删除,其余字符保留,输出处理后的字符串。需要保证字符出现的先后顺序,并且区分大小写。详细描述:接口说明原型:int GetResult(const char *input, char *output)输入参数: input 输入的字符串输出参数(需考虑指针指向的内存区域是否有效): output 输出的字符串返回值: 0 成功 -1 失败及异常举例:输入: abadcbad,那么该单词中红色部分的字符在前面已经出现过。则:输出abdc,返回0。知识点: 工程环境请使用VS2005题目来源: 软件训练营 维护人: d00191780 练习阶段: Code/*---------------------------------------* Date: 2015-06-30* sjf0115* title: Delete Duplicate character/delete duplicate S

[Huawei Machine Test exercises]16. Digital statistics

arrayint* Pminnum: The number of minimum values in the array is returned: void*/void Outputmaxandmin (int* Pinputinteger,intInputnum,int* Pmaxvalue,int* Pmaxnum,int* Pminvalue,int* Pminnum) {if(Pinputinteger = = NULL | | Inputnum 0){return; }//if *pmaxvalue= pinputinteger[0];*pminvalue= pinputinteger[0];*pmaxnum=1;*pminnum=1; for(inti =1; i //Update Maximum Valueif(Pinputinteger[i] >*pmaxvalue){*pmaxvalue= Pinputinteger[i];*pmaxnum=1; }//if Else if(Pinputinteger[i] = =*pmaxvalue){

[Huawei Machine Test exercises] 2. Sum of large numbers

Topic two [large number sum]Describe:Given two very large positive integers a and B, the number of digits is between 50 and 100. Seeking c=a+b;Title Category: StringDifficulty: IntermediateOperating time limit: 10SecMemory Limit: 128MByteStage: Pre-employment practiceInput:Because A and B are large, from high to low, enter two lines of numbers a and B as strings. The number of bits A and B is between 50 and 100.Output:Outputs a line as a string, representing the and of A and B.Sample input:11111

[Huawei Machine Test exercises]24. Delete repeated nodes in the linked list, reverse output of the remaining nodes

repeated out times while(p) {if(Map.count (p->data) = =0) {Map.insert ( mapint,int>:: Value_type (P->data,1)); }//if Else{Map[p->data] = map[p->data]+1; }//elsep = p->pstrnext; }//while //For recurring reverse output to Pstroutp = Pstrin; vectorint>Vec while(p) {if(Map[p->data] = =1) {Vec.push_back (p->data); }//ifp = p->pstrnext; }//while intSize = Vec.size ();if(Size = =0){return 0; }//if for(inti =0; I 1; ++i) {strnode* node =NewStrnode (); Node->data = Vec[i];

[Huawei on-machine exercises] 7. Delete the characters with the fewest occurrences in the string

TopicDescribe:Implements the fewest occurrences of characters in a deleted string, and is deleted if multiple occurrences of the character are the same. The output deletes the string after these words, and the other characters in the string remain in the original order.Title Category: StringDifficulty: IntermediateOperating time limit: 10SecMemory Limit: 128MByteStage: Pre-employment practiceInput:string contains only lowercase English letters, regardless of illegal input, the input string lengt

[Huawei machine trial exercise questions] 16. Digital statistics, Huawei exercises

[Huawei machine trial exercise questions] 16. Digital statistics, Huawei exercises Question Title: for the input integer array, the number of maximum, maximum, minimum, and minimum values in the output array element. Detailed Description: Interface Description prototype: voidOutputMaxAndMin (int * pInputInteger, intInputNum, int * pMaxValue, int * pMaxNum, int * pMinValue, int * pMinNum); input parameter:

Oracle's SQL statement on-machine exercises and Answers (i)

(hiredate, ' mm ') = ' 02 ';   --23, for each employee, shows the number of days they joined the company   Selectename,sysdate-hiredate from EMP   --24, displays the names of all employees that contain "A" in the Name field   Selectename from EMP where ename like '%a% ';   Selectename from EMP where InStr (ename, 'A ', 1) >0;   --25, year, month and day show the service life of all employees   Selectmonths_between (sysdate,hiredate)/12as "year", Months_between (sysdate,hiredate) as "month", sy

[Huawei on-machine exercises] 6. Sorting integers

intnum =0;//Do not consider illegal input for(inti =0; I if(i = = Size | | str[i] = =', ') {vec.push_back (num); num =0; }//if Else if(Str[i] >=' 0 ' Str[i] ' 9 ') {num = num *Ten+ Str[i]-' 0 '; }//else}//for //SortSort (Vec.begin (), Vec.end ());intCount = Vec.size ();intStart =0; for(inti =1; I if(i = = Count | | vec[i]! = vec[i-1]+1){//-1 Mark Delete for(intj = start+1; J 2; ++j) {Vec[j] =-1; }//forstart = i; }//if}//for returnVEC;}intMain () {stringStr vector

Total Pages: 15 1 2 3 4 5 6 .... 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.