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
Steps and methods of exercise
(1) skillful routines and clear posture
The so-called "routine" refers to the entire architecture of Taijiquan. The so-called "posture" refers to the action structure of each type. At the beginning of the school, the primary focus is on the routine proficiency, and the orientation is correct. Pay attention to the posture specification. After a period of practice, the routine has been skilled. At this time, you must focus
[C language exploration tour] Part 2 Lesson 10: Exercise questions and exercises, study tours
Introduction
1. Course outline
2. Part 2 Lesson 11th: Exercise questions and exercises
3. Part 3 Lesson 1 notice: Install SDL
Course outline
Our courses are divided into four parts. Each part has exercise questions after completion and answers will be published. Th
This is a creation in
Article, where the information may have evolved or changed.
In the previous article go与C基本类型转换 (http://blog.csdn.net/freeape/article/details/51885308), but in the actual project is not only used in the conversion between the
This is a creation in
Article, where the information may have evolved or changed.
In the previous article go与C基本类型转换 (http://blog.csdn.net/freeape/article/details/51885308), but in the actual project is not only used in the conversion between the
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
in range (4): li.append (str (random.randint (0,9))) print ("". Join (LI)) Generate four-bit verification codes with numbers and letters1, Method one Import random num_l = list (map (str,list (range))) #获取以0-9 String for the listing of elements del_l = lists (range (91,97)) Chr_ L = [Chr (i) if I not in del_l else "for I in Range (65,123)] #获取大小写的a-Z list, remove the middle 6 special characters num_l.extend (chr_l) #将字母和 The numbers are grouped together res_l = num_l res_str = ""
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.