CodePudding user response:
Is anyone here
CodePudding user response:
Soon, the two questions give you the answer you want to read a afternoon will be able to write a program to their own, but I'm curious, why it happened that is the problem? Is class c + + curriculum design requirements to make these two?
Joseph ring problem:
Thinking:
(1) the first thought is to use circular linked list, each time from the list to remove a node, until leaving a node list, but the list of read speed is slow, every visit to back the first m nodes is also very time-consuming,
(2) and then think of using arrays, array read speed is fast, but after delete an element, move the remaining elements also takes a lot of time,
(3) there is no array but does not remove elements method, each number, delete the element value set to 1, every 26 m not to 1, this value set to 1, until only one is not in an array of 1 element, the element value is the answer,
Although the first (3) methods have an array of random access speed, also need not remove elements, but the large amount of data, run to the behind array element contains a value of 1, must carry on the multiple loop, speed is slow, also direct timeout after submission, the fastest is a mathematical method, find out the problem of recursive formula, a few lines of code,
(4) mathematical methods (recursive formula for f (N, M)=(f (N)? 1, M) N + M) %), the formula can be derived to search, CSDN on a lot of articles this formula is derived, and understand this formula has a little difficult, but if you were to do this and do it, don't understand it doesn't matter, directly to the recursive formula written recursive programs, the above several methods written in c + + program see https://blog.csdn.net/weixin_43222324/article/details/105216765
CodePudding user response:
refer to the second floor of shu Yang reply: soon, the two questions give you the answer you want to read a afternoon will be able to write a program to their own, but I'm curious, why it happened that is the problem? Is class c + + curriculum design requirements to make these two? Joseph ring problem: Thinking: (1) the first thought is to use circular linked list, each time from the list to remove a node, until leaving a node list, but the list of read speed is slow, every visit to back the first m nodes is also very time-consuming, (2) and then think of using arrays, array read speed is fast, but after delete an element, move the remaining elements also takes a lot of time, (3) there is no array but does not remove elements method, each number, delete the element value set to 1, every 26 m not to 1, this value set to 1, until only one is not in an array of 1 element, the element value is the answer, Although the first (3) methods have an array of random access speed, also need not remove elements, but the large amount of data, run to the behind array element contains a value of 1, must carry on the multiple loop, speed is slow, also direct timeout after submission, the fastest is a mathematical method, find out the problem of recursive formula, a few lines of code, (4) mathematical methods (recursive formula for f (N, M)=(f (N)? 1, M) N + M) %), the formula can be derived to search, CSDN on a lot of articles this formula is derived, and understand this formula has a little difficult, but if you were to do this and do it, don't understand it doesn't matter, directly to the recursive formula written as recursive programs, the above several methods written in c + + program see https://blog.csdn.net/weixin_43222324/article/details/105216765 Is a job, but my idea is said is not simple to understand these two, but later had a similar problem can do it CodePudding user response:
The first topic, largest product: https://blog.csdn.net/weixin_43746343/article/details/90438122 CodePudding user response:
reference qq_45079277 reply: 3/f Quote: refer to the second floor of shu Yang reply: soon, the two questions give you the answer you want to read a afternoon will be able to write a program to their own, but I'm curious, why it happened that is the problem? Is class c + + curriculum design requirements to make these two? Joseph ring problem: Thinking: (1) the first thought is to use circular linked list, each time from the list to remove a node, until leaving a node list, but the list of read speed is slow, every visit to back the first m nodes is also very time-consuming, (2) and then think of using arrays, array read speed is fast, but after delete an element, move the remaining elements also takes a lot of time, (3) there is no array but does not remove elements method, each number, delete the element value set to 1, every 26 m not to 1, this value set to 1, until only one is not in an array of 1 element, the element value is the answer, Although the first (3) methods have an array of random access speed, also need not remove elements, but the large amount of data, run to the behind array element contains a value of 1, must carry on the multiple loop, speed is slow, also direct timeout after submission, the fastest is a mathematical method, find out the problem of recursive formula, a few lines of code, (4) mathematical methods (recursive formula for f (N, M)=(f (N)? 1, M) N + M) %), the formula can be derived to search, CSDN on a lot of articles this formula is derived, and understand this formula has a little difficult, but if you were to do this and do it, don't understand it doesn't matter, directly to the recursive formula written as recursive programs, the above several methods written in c + + program see https://blog.csdn.net/weixin_43222324/article/details/105216765 Is a job, but my idea is said is not simple to understand these two, but later had a similar problem can do good student ah, I think the better programming assignments are copied, packing up someone else's program, results in the program name or a roommate's name, the teacher saw a decompression assignment is people's names, CodePudding user response:
reference 5 floor shu Yang reply: Quote: refer to the third floor qq_45079277 response: Quote: refer to the second floor of shu Yang reply: soon, the two questions give you the answer you want to read a afternoon will be able to write a program to their own, but I'm curious, why it happened that is the problem? Is class c + + curriculum design requirements to make these two? Joseph ring problem: Thinking: (1) the first thought is to use circular linked list, each time from the list to remove a node, until leaving a node list, but the list of read speed is slow, every visit to back the first m nodes is also very time-consuming, (2) and then think of using arrays, array read speed is fast, but after delete an element, move the remaining elements also takes a lot of time, (3) there is no array but does not remove elements method, each number, delete the element value set to 1, every 26 m not to 1, this value set to 1, until only one is not in an array of 1 element, the element value is the answer, Although the first (3) methods have an array of random access speed, also need not remove elements, but the large amount of data, run to the behind array element contains a value of 1, must carry on the multiple loop, speed is slow, also direct timeout after submission, the fastest is a mathematical method, find out the problem of recursive formula, a few lines of code, (4) mathematical methods (recursive formula for f (N, M)=(f (N)? 1, M) N + M) %), the formula can be derived to search, CSDN on a lot of articles this formula is derived, and understand this formula has a little difficult, but if you were to do this and do it, don't understand it doesn't matter, directly to the recursive formula written as recursive programs, the above several methods written in c + + program see https://blog.csdn.net/weixin_43222324/article/details/105216765 Is a job, but my idea is said is not simple to understand these two, but later had a similar problem can do good student ah, I think the better programming assignments are copied, packing up someone else's program, results in the program name or a roommate's name, the teacher saw a decompression assignment is people's names, Can't ah, high school didn't study hard, now ready to one's deceased father grind to take an examination of a good school CodePudding user response:
refer to 6th floor qq_45079277 response: Quote: refer to the 5 floor shu Yang response: Quote: refer to the third floor qq_45079277 response: Quote: refer to the second floor of shu Yang reply: soon, the two questions give you the answer you want to read a afternoon will be able to write a program to their own, but I'm curious, why it happened that is the problem? Is class c + + curriculum design requirements to make these two? Joseph ring problem: Thinking: (1) the first thought is to use circular linked list, each time from the list to remove a node, until leaving a node list, but the list of read speed is slow, every visit to back the first m nodes is also very time-consuming, (2) and then think of using arrays, array read speed is fast, but after delete an element, move the remaining elements also takes a lot of time, (3) there is no array but does not remove elements method, each number, delete the element value set to 1, every 26 m not to 1, this value set to 1, until only one is not in an array of 1 element, the element value is the answer, Although the first (3) methods have an array of random access speed, also need not remove elements, but the large amount of data, run to the behind array element contains a value of 1, must carry on the multiple loop, speed is slow, also direct timeout after submission, the fastest is a mathematical method, find out the problem of recursive formula, a few lines of code, (4) mathematical methods (recursive formula for f (N, M)=(f (N)? nullnullnullnullnullnullnullnullnullnullnullnullnullnullnull