1026:c Language Programming Tutorial (third Edition) After class exercise 7.4 The topic describes an array of 9 elements that have already been sorted, and entering a number now requires that it be inserted into the array in the same order as it was originally ordered. Enter the first line, the original sequence. The second line, the number that needs to be inserted. Output sorted sequence sample input1 7 8 17 23 24 59 62 10150Sample output17817232450
Eighth Chapter8-6. Decomposition of the element factor. Write a function based on the IsPrime () and getfactors () functions in the previous exercise, which takes an integer as a parameter and returns a list of all prime factors for that integer type. This process is called the decomposition of the element factor, and the product of all the factors it outputs should be the original number. Note that there may be duplicate elements in the list. For exa
Figure exercise-bfs-the shortest number of steps from the start to the target point
Time limit:1000ms Memory limit:65536k have questions? Dot here ^_^
Title description in the ancient Warcraft legend, there are two legions, one called the Scourge, one called Janissary. In their area, there are n passes, numbered 1. N, there is a channel connection between some passes. Among them, the Legion was in the 1th, and the Scourge was in the N
Basic Exercise II:1, some numbers exist in the list, such as: L = [1, 3, 2, 1, 6, 4, 2, ....., 98, 82]1) Save the number appearing in list L in another list L2Requirements:Repeated occurrences of a number only keep one copy in the L2 list (deduplication)2) Save the number that appears in the list two times in the L3 list (keep one copy in the L3 list)L = [1, 3, 2, 1, 6, 4, 2, 98, 82] #1) Save the number appearing in list L in another list L2#Requirem
Exercise 9.39: known to have the following string object: string line1 = " we were her pride of ten she named us: string line2 = " benjamin, Phoenix, The Prodigal " string line3 = " and perspicacious perspicacious Pacific Suzanne " string sentence = line1 + ' + line2 + ' ' + line3; The program calculates how many words are in the sentence and points out the longest and shortest words. If there are multiple shortest or longest wo
Exercise 1-13 Write a program that prints a histogram of the word length in the input.1#include 2 3 /*count digits, white space, others*/4 5 intMainintargcChar Const*argv[])6 {7 intC, I, J, Nwhite, nother;8 intndigit[Ten];9 TenNwhite = nother =0; One for(i =0; I Ten; ++i) { ANdigit[i] =0; - } - the while((c = GetChar ())! =EOF) { - if(c >='0' C '9') { -++ndigit[c-'0']; -}Else if(c = =' '|| c = ='\ n'|| c = ='\ t') { +++N
Exercise 7.7: Use these new functions to rewrite the transaction handlers in the 7.1.2 practice sessionSales.data.h#ifndefsales_data_h#definesales_data_h#include main.cpp#include "Sales_data.h" Intmain (INTNBSP;ARGC,CONSTNBSP;CHARNBSP;**ARGV) { sales_datatotal;if (Read (std::cin,total)) { Sales_datatrans; while (Read (Std::cin,trans)) { if (TOTAL.ISBN () ==TRANS.ISBN ()) { total=add (Total,trans); }else { nbsP;print (std::cout,total) This article i
Exercise 2:Enter a number from the keyboard to determine whether the number is primePrime number: Numbers that can be divisible only by 1 and themselvesThe original answer is:public class Testscanner {public static void Main (string[] args) {Scanner scan = new Scanner (system.in);System.out.println ("Please enter an integer:");int i = Scan.nextint ();for (int j = 2; J if (i% j = 0) {System.out.print (i + "not prime number");Return;//didn't know to use
Question B: Exercise 6-5 array element reverse
time limit: 1 Sec memory limit: MBFlowers: 183 Resolution: 171Flowers Wreath [TK Bank]
Title DescriptionStores the values in an integer array of length 10 in reverse order.For example: The original order is 1,2,3,4,5,6,7,8,9,0, the request is changed to 0,9,8,7,6,5,4,3,2,1InputEnter 10 integers separated by a space from the keyboard.The output outputs these 10 numbers in reverse order, one row fo
1. Comprehensive exercise: Draw one side of the flag, put the code with the run Publish blog to hand in the homework.The code is as follows:1 ImportTurtle2 3 defMygoto (x, y):4 turtle.up ()5 Turtle.goto (x, y)6 Turtle.down ()7 8 defDrow (x):9 Turtle.begin_fill ()Ten forIinchRange (5): One Turtle.forward (x) ATurtle.right (144) - Turtle.end_fill () - theTurtle.setup (600,400, 0,0) -Turtle.color ("Yellow") -Turtle.bgcolor ("Red") -Turtle.fillcolor
Tree structure Exercise--sequential traversal of ordered binary tree
Time limit:1000ms Memory limit:65536k
Topic description in the tree structure, there is a special two-fork tree called the sort binary tree, the intuitive understanding is--(1). Each node contains a key value (2). The key value of any node's Zuozi (if present) is less than the key value of that node (3). The key value of the right subtree (if present) of any one node
Exercise 3-6Enter cardinality B (2#include Summary: N>0 can be used as a condition for judgingExercise 3-7Enter cardinality B (2#include Algorithmic competition Getting Started classic exercise 3-5 3-6 binary conversion
2407:c language exercise integer conversion to string time
limit:1 Sec Memory limit:128 MBsubmit:917 solved:416[Submit] [Status] [Web Board]
DescriptionConverts an integer n to a string using recursion. For example, enter 483 and the string "483" should be output. The number of bits of n is indeterminate and can be an integer of any number of digits.InputNOutputThe corresponding stringSample Input483Sample Output4 8 3HINTThe main function is
This is the table used in the exercise:--1.select DNO from Dept where dname= ' mathematics Department 'Select Sno,sname from student where dno= (select DNO from dept where dname= ' Mathematics Department ');--2. Number of students who have elective coursesSELECT DISTINCT Sno from SC;--3. The number of students enrolled in the No. No. 01 course and results, the results of the search by grade in ascending order, the same results by the number of descend
Exercise can consume calories, promote metabolism, improve diet rules, beauty, detoxification, fitness, cure, improve mood, and help improve a series of sub-health.
Daily exercise can improve your anxiety and ease your mood. It can also promote blood circulation, strengthen cell metabolism, and achieve a healthy effect! Sports can cure all diseases and prevent diseases ............
Benefits of sports:
much as possible, and then put down slowly. After this exercise is performed evenly, the knees bend and continue to perform the same action. Repeat eight times. 4. sit-and-bend: mainly refers to the development of upper and lower abdominal muscles. Straighten your knees, move up your upper body, maintain balance, and bend your knees to lower your abdomen to make your abdominal muscles bend. In practice, the foot is always inaccessible to the ground.
Exercise 2.1Q: What is the difference between type int, long, long long and short, and what is the difference between unsigned and signed types? What is the difference between a float and a double?A:int, long, long long and short sizes differ in the range of data represented. Unsigned can only represent 0 and positive numbers, and unsigned can also represent negative numbers. Float is a single-precision floating-point number, double doubles, in genera
Problem DescriptionEnter an unsigned short integer k[hex.] and P[oct.], the high byte of K as the low byte of the result, and the high byte of p as the result of the high byte to form a new integer.InputK[hex.] and P[oct.]OutputThe operation gets the new integer n.Sample Input0XD9 01117Sample Output200HINTOutput is 16 binary1#include 2 intMain ()3 {4 5 intk,p;6 while(SCANF ("%x%o", k,p)! =EOF)7 {8 intNewint = (p0xff00)| (k0xff00) >>8;9printf"%x\n", newint);Ten }
‐‐‐| ')Print (' |‐‐‐1: Query contact information ‐‐‐| ')Print (' |‐‐‐2: Insert new contact ‐‐‐| ')Print (' |‐‐‐3: Delete existing contact ‐‐‐| ')Print (' |‐‐‐4: Exit Address Book Program ‐‐‐| ')contacts = Dict ()While 1:instr = Int (input (' \ n Please enter the relevant instruction code: '))If InStr = = 1:Name = input (' Please enter contact name: ')If name in Contacts:Print (name + ': ' + contacts[name])ElsePrint (' The name you entered is no longer in the address Book! ‘)If InStr = = 2:Name
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.