It is not very difficult to see an algorithm question on the Internet. There are also solutions for searching, but there are usually several layers of for loops. I tried to write it down.
/*** Give you a set of strings such as {5, 2, 3, 2, 4, 5,}, so that you can output the
Package com; public class test {public static void main (string [] ARGs) {system. out. println (getsteps1 (); system. out. println (">>>>>>>>>>>>>>>>>>>>>>>>>>>>"); system. out. println (test. getsteps (); system. out. println (">>>>>>>>>>>>>>>>>>>>>>>>>>>> ");} public static int getsteps () {// use the minimum public multiple to reduce the number of traversal times. Int I = 1; int step = 2; Boolean maxstep = false; while (true) {system. Out. Print ("
There is a fractional sequence of 2/1 + 3/2 + 5/3 + 8/5 + 13/8 +... Find the sum of the first 20 items of the series.Program:
# Include
Output result: 32.660261 Press any key to continue
C language: There is a score sequence: 2/1 + 3/2 + 5/3 + 8/5 + 13/8 +... Find the sum of the first 20 items in this seriesProgram:
# Include
Output result: 32.660261 Press any key to continue
Starting 3 threads, thread 1 printing 1 to 5, thread 2 printing 5 to 10, thread 3 printing 11 to 15, then thread 1 printing 16 to 20, and so on ...
Print until 30 public class Mainthread {private static int num;//current record number private static final int threadnum
Vector used: # include # Include Using namespace STD;
Int fenshu (INT );
Int main ()
{
Double sum = 0, sum1 = 0;
For (INT I = 2; I {
Sum1 + = fenshu (I );
}
Sum = sum1 + 0.5;
Cout Return 0;
}
Int fenshu (INT index)
{
Double temp;
Vector A. Reserve (3 );
A. At (0) = 1;
A. at (1) = 2;
For (INT I = 2; I {
A. insert (A.
In order to omit the space and make it visible to the operator who manually fills in the paper, the volume number on the card of the materials shelf is determined to be classified and sorted, as shown in
A-3, A-4, A-5, A-8 forming A-3 ~ 5, 8, etc.
The following code uses a few auxiliary list
/// /// Similar to 1,
Package COM. WZS; // Add difficulty to the first question. Use the numbers 1, 2, 3, 4, and 5 to write a main function in Java and print out all the different orders, // For example, 51234, 12345, etc., the requirement: "4" cannot be In the third place, "3" and "5" cannot be
Problem description: there are now n ordered arrays in M groups, such as {1, 2, 3, 4}, {2, 3, 6}, {1, 3, 5, 7 }, select the data smaller than K in these arrays and return this value.
Idea: Compare the minimum data selected each ti
/***//**
* Fractionserial. Java
* There is a fractional sequence: 2/1, 3/2, 5/3, 8/5, 13/8, 21/13...
* Calculate the sum of the first 20 items of the series.
* @ Author Deng Chao (codingmouse)
* @ Version 0.2
* Development/test en
Calculate the sum of the First n items of the Fibonacci fractional sequence (N is a constant, and the Fibonacci fractional sequence is 2/1, 3/2, 5/3, 8/5 ,...).
# Include
Stdio. h
>
# Include
Conio. h
>
Void
# Include
}/* The numerator behind the score is equal to the numerator plus the denominator of the previous score, and the denominator of the subsequent score is equal to the numerator with the previous score */
There is a fractional sequence: 2/1, 3/2, 5/3, 8/
Opencv experiences (1)
The second chapter of learning opencv mainly introduces some common and interesting functions and data types, so that students at the beginning are more interested in image processing, although I do not understand the internal experiment of the function and the meaning of some defined constants, I am still very happy after learning Chapter 2. At least I know some basics of image processing, such as contour processing;
Knowledge
Int a [5] = {1, 2, 3, 4, 5}; printf ("% d \ n", * (int *) ( a + 1)-2 );, printf % d
What is the result of a certain convincing pen question in a certain year? The answer is 4. Why?
My understanding (do not know if it is correct ):
A is an array pointer of the int type [
47. Innovation workshop (algorithm ):Returns the longest descending subsequence of an array, for example, {9, 4, 3, 2, 5, 3, 2,4,3, 2}
Idea: Dynamic Planning
Calculates the longest descending subsequence of the sequence of the current number. Each time you look for the long
1#include 2 using namespacestd;3 4 intMain ()5 {6 Longnum;7 8 while(Cin >>num) {9 if(num = =1){Tencout Endl; One Continue; A } - - for(inti =2; I i) { the if(num%i = =0){ -num = num/i; -cout " "; -i--;//When a prime number is encount
// Question: decompose a positive integer into a prime factor. For example, enter 90 and print 90 = 2*3*3*5.// Program analysis: to decompose the prime factor of N, you should first find a minimum prime number k, and then follow the steps below to complete:// (1) if the prime number is equal to N, it indicates that the
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.