/***//**
* 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 environment: jdk1.6 + eclipse SDK 3.3.2
*/
Public class fractionserial ...{
Public static void main (string [] ARGs )...{
/**//*
* Not
# 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/5, 13/8, 21/13... find the sum of the first 20 items of this series
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 =3;//open Task thread count private static final int loopnum = number of 2;//threadnum thr
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
ArticleDirectory
Bruce Eckel's point of view: Reading, analyzing, summarizing, and practicing
Jeff Atwood (coding horror): Technical blog importance
5% myth
Bruce Eckel (author of thinking in Java/C ++) mentioned in his 5% myth (mythical 5%): 5%ProgramDeveloper development efficiency is
Static void main (string [] ARGs){Int COUNT = 0;// A maximum of 100 types of data may consist of 1 RMBFor (int A = 0; A {// There are up to 50 possibilities in the case of 2 RMBFor (INT B = 0; B {For (int c = 0; C {// 10 RMB, up to 10 possibilitiesFor (int d = 0; D {// In the case of 20 yuan, a maximum of 5 possibilitiesFor (int e = 0; e {// 50 RMB, up to 2 possibilitiesFor (INT f = 0; F {If (1 * A + 2 * B
Light Rail. After all, during the day, the sports meet for a day and our physical strength is exhausted. At this timeEddieSaid to me, take out your telescope and see where there is a car. Right, I immediately took it out and searched for it on the road. "There is a public car in front, and someone gets off the bus. It's driving." Haha, it was a coincidence that we immediately rushed up and finally went home. We all said this when we got on the bus.
It's already fast to lie down at home.2I
Given the sequence of KK integers {n_1n 1, n_2n 2, ..., n_kn K}, continuous sub columns are defined as {n_in I, n_{i+1}n i+1, ..., N_jn J}, where 1 \le i \le j \ Le k1≤i≤j≤k. Maximum sub columns and is defined as the largest of all contiguous child column elements. For example, given the sequence {-2, 11,-4, 13,-5,-2}, its contiguous sub columns {11,-4, 13} have the largest and 20. You are asked to write a
the seniority of N-N employees in a given company requires that the number of employees in each seniority segment be output by seniority. Input format:The input first gives a positive integerNn ( \le 10^5≤10?5?? ), that is, the total number of employees; then give nn integers, that is, the seniority of each employee, in the range of [0, 50]. Output format:The number of employees per seniority is output in
Enter an integer (no more than 9 digits) to represent a renminbi value (in yuan), please convert the uppercase Chinese format to the financial requirements. such as 23108 Yuan, converted into a "Wan Baize ba" Yuan. In order to simplify the output, the lowercase English letter a-j order represents the capital number 0-9, with S, B, Q, W, y respectively represents pick, hundred, thousand, million, billion. So 23108 yuan should be converted to output as "Cwdqbbai" Yuan.Input format:The input gives
minutesC. The retrieval operation of any 50-word search cannot exceed 20 millisecondsD. the retrieval speed will not change because of the index quantity, and the indexing speed will not slow down because of the document quantity or document size.E. Development Tool vs2010. The testing environment includes ipvs7 + CPU (AMD 2.0), 5400 to GB hard drive, and 2 GB memory.Note: The current standalone index is limited to
A program is required to calculate the average of n rational numbers.Input format:Enter the first line to give the positive integer n (≤100), the second line in a1/b1 a2/b2 … the format given n fractional form of the rational number, where the numerator and denominator are all integers in the shaping range, if negative, the negative sign must appear at the front. Output format:The a/b average of n rational numbers is output in the format of a row. Note must be the simplest fractional form of the
, obviously at a very high cost. So normally concurrentlinkedqueue needs to be paired with a atomicinteger to get the queue size. This idea is used by the Blockingqueue described later.Listing 3 Calendar Queue Size
public int size () {int count = 0;for (nodeif (p.getitem () = null) {Collections.size () Spec says to max outif (++count = = Integer.max_value)Break}}return count;}
Resources:
Simple, Fast, and practical non-blocking and Blocking Concurrent Queue algorithm
: Normal;background-color:rgb (246,246,246); "/>Each image should have a file in the directory, named after the image ID.In the next section we will actually operate the Glance.650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160412-1460472069315043178.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;background-color: RGB (246,246,246); "/>
Full-stack JavaScript path (20) html 5 insertion html Tag (2) insertAdjacentHTML, full-stack javascript path
InsertAdjacentHTML (), which was first introduced in IE, is now included in the html5 specification. It accepts two parameters, one of which is one of the following tags, one is the html code text to be written.
Browsers that support the insertAdjacentHTML () method include IE, Firefox 8 +, Safar
-price2 print(‘-------------------‘) for i in names1: num = names1.index(i) price = names2[names1.index(i)] print(num, i, price) print(‘-------------------‘) _abc=input(‘你是否要继续购物:(add)or(other)‘) else: print("you money is not enougy") breakprint("你购买的商品:",names3)print(‘你的余额:‘,salary)2. After the perfect procedureproduct_list=[(' Iphone ', 5800), (' Mac Pro ', 9800), (' Bike ', 8000), (' book ', ' + '), (' Car ', "200"), (' food ') ] #
First, the problem analysisIn the case of violent resolution, the total number of cases considering the sub-paragraph is 1+2+...+n=o (n^2). Considering the dynamic programming algorithm, the complexity of O (n) algorithm can be realized.Second, the program designIii. Results of the procedureIf the sequence is full of negative numbers, it is actually choosing the maximum valueGiven a sequence of n integers a1,a2,..., An to find the maximum value of the sequence sub-segment and, for example, when
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.