the execution, print a line prompt "Please input a number", ask the user to enter a value, then print out the value, and then ask the user to enter a value again, know user input end stopWhile:DoRead-p "Please input a number:" NIf ["$n" = = "End"]ThenExitFiM= ' echo $n |sed ' s/[0-9]//g 'If [-N ' $m '] is not emptyThenecho "It ' s not number,please input a number."ElseEcho $nFiDoneOutput warning when the root directory is on a hard drive with a usage greater than 85%DF |awk ' $6== '/' 'DF |awk
last line?Jump To line 20, enter 20GLast line, enter G9. Vim when the document is opened, the default is not to display the line number, how do you let it display line number?: Set NuAfter Vim opens the document, I want to replace the first ' ABC ' in line 20-50 with ' EFG ' How to do it? What if you want to replace all of them?: 20,50S/ABC/EFG replaces only the first one: 20,50s/abc/efg/g Replace AllOne. Vim how to quickly delete the first 100 lines after opening a document?First press ' GG '
Practice1, every Monday to Saturday 3:20 A.M., run the CP command to save the/etc/directory, storage locationFor/BACKUPS/ETC-YYYY-MM-DD;3 * * 1-6/bin/cp-a/etc/tmp/etc-' Date +\%f '2, every Sunday 2:30 A.M., run the CP command to backup the/etc/fstab file, the storage location is/backup/fstab-Yyyy-mm-dd-hh-mm-ss2 * * 7/bin/cp-a/etc/fstab/backup/fstab-' date +\%f-\%h-\%m-\%s '3, every night 12 o'clock, get all the lines in the/proc/meminfo file starting with S or M, appendTo the/statistics/meminfo
users on the current system;Answer: egrep ' ^\650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/42/wKiom1XfPSqz6lI4AACQQXuSyc0904.jpg "title=" Grep5.png "style=" Float:none; "alt=" wkiom1xfpsqz6li4aacqqxusyc0904.jpg "/>6 Find a word in the/etc/rc.d/init.d/functions file (the middle of the word can be underlined) followed by a set of parentheses line;Answer: grep-e--color=auto ' \650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/3F/wKioL1XfP0OgsLIrAAH7aR7gbrw569.jpg "ti
1. The following variables are not named correctly (D)A. Foo = the_value B. Foo = l_value C. Foo = _value D. Foo = value_2. Calculate the value of 2 of the 38-time SquarePrint (2**38)2748779069443. The result of the following logical operation: A. True and False # false B. False and True # false C. True or False # D. False or True # E. True or False and true # True F. True and false or False # False 4. Write a program to calculate the results of 1+2+3+...+100sum = 0 for i
fromFunctoolsImportWraps#1. Write adorners to add authentication functions to multiple functions (the user's account password originates from the file)#Once the login is successful, subsequent functions do not need to enter the user name and passworddefget_zhpwd (): F= Open ('pwd','R', encoding='Utf-8') Content= F.readline (). Split (' ') returnContentflag=FalsedefLogin1 (func):defInner (*args,**Kwargs):GlobalFLAG" "Login" " ifFLAG:Print("already logged in.") ret= Func (*args,**Kwargs)
Title: Determine the number of primes between 101-200 and the output of all primes.The method of judging primes: to remove 2 to sqrt (this number) with a number, if divisible, indicates that the number is not a prime, and vice versa.PublicclassTest2 {//determines whether the prime number is public boolean isprime (int n) {if(n = = 1) { returnfalse; } for(int i=2;i) { if(n%i==0) {returnfalse; }Else { Continue; } } returntrue; } //numbe
Topic现在有一个行和列都排好序的矩阵,请设计一个高效算法,快速查找矩阵中是否含有值x。给定一个int矩阵mat,同时给定矩阵大小nxm及待查找的数x,请返回一个bool值,代表矩阵中是否存在x。所有矩阵中数字及x均为int范围内整数。保证n和m均小于等于1000。测试样例:[[1,2,3],[4,5,6],[7,8,9]],3,3,10返回:falseAnalytical
C + + Edition
class Finder {public: bool findX(vector
Python version
# -*- coding:utf-8 -*-class Finder: def findX(self, mat, n, m, x): # write code here row=n-1 col=0 while row>=0 and colChapter II Sorting | | The 18th section of the ordered matri
) * (1 + 0.00417); T=s; } System.out.println ("After six months, result is:" +s); }}2.16 Public classTest { Public Static voidMain (string[] args) {Scanner input=NewScanner (system.in); System.out.print ("Enter The amount of water in kilogram:" ); Doublem =input.nextdouble (); System.out.print ("Enter The initial temperature:" ); Doubleit =input.nextdouble (); System.out.print ("Enter The final temperature:" ); DoubleFT =input.nextdouble (); System.out.println ("The energy needed is" + M * (ft-i
1. Write an adorner to see when the function executesImport datetimeImport timedef jishi (fun): Def warper (): Start_time = Datetime.datetime.now () Fun () End_time = Datetime.datetime.now () Haoshi = (end_time-start_time). Total_seconds () Print ("function run time {}". Format (Haoshi)) Return Warper ()@jishiDef Yunsuan (): Time.sleep (2) For x in range (100): Print (x)Yunsuan ()Summary: The general idea is to use local time after the function is run minus
# Fifth: The find function that implements a string by itself# 1. Find another string in a string# 2. Found where the first occurrence of the return occurred# 3. Not found return-1# 4. Parameter S1 is the source string, parameter s2 is the string to finddef index_of_str (S1, S2): #split这个 function to split the character and return a list of the split elements Lt=s1.split (S2) #判断分割后的列表的元素个数, if the number of elements is one, there is only one element in the list stating that there are no S
best way to do this is to sort by (). (2 points)
Hill
Bubble
Fast
Exchange
Author : ShangUnit : City College of Zhejiang University2-29(Neuds) The record with the highest key value from the sequence to be sorted is placed in an ordered sequence called (). (2 points)
Hill sort
Direct Select sort
Bubble sort
Quick Sort
Title Answer result Score2-3d Answer right 22-4c Answer right 22-5A Answer right 22-6b Answer right 22-7c Answer right 22-8c Ans
1 three digits in reverse order (5 points)Topic content:Three-digit number in reverse order:The program reads a positive three-digit number each time, and then outputs the number in reverse order. Note that when the input number contains the end of 0 o'clock, the output should not have a leading 0. For example, enter 700 and the output should be 7.Hint: With%10 can get single digit, with/100 can get hundred number .... The three numbers that are obtained are combined: Hundreds *100+ 10 bits *10+
"" "Title: the bonus paid by the enterprise is based on the profit commission. Profit (I) less than or equal to $100,000, the bonus can be raised by 10%, the profit is higher than $100,000, less than $200,000, the portion of less than 100,000 yuan by 10% commission, higher than the portion of 100,000 yuan, a commission of 7.5%, 200,000 to 400,000, higher than 200,000 yuan, can commission 5% ; Between 400,000 and 600,000 is higher than the portion of 400,000 yuan, can commission 3%, 600,000 to 1
1. Use while loop input 1 2 3 4 5 6 8 9 10i = 1 while I : if i! =7 :print(i )else: print(") + = 12. For all numbers of 1-100i = 1= 0 while I : + = I + = 1print(sum)3. All odd numbers in output 1-100i = 1 while I : print(i )+ = 24. All even numbers in output 1-100i = 2 while I : print(i )+ = 25, Beg 1-2+3-4+5 ... 99 of all numbers of the andi = 1= 0 while I : if i%2 = = 1: + = I C10>else: - = I+ = 1print(sum)6. User Login (three cha
input numbers and symbols varA =document.getelementbyid ("one"). Value, b=document.getelementbyid ("the"). Value, C=document.getelementbyid ("FH"). Value; //The function method is called, and the returned value is received varnum =method (A,B,C); document.getElementById ("JG"). innerhtml=num; } Number 1:Number 2:Symbols:4 Full selection/All-in-one effect. If the check box below is not selected, the Select all check box is automatically unchecked and checked automatically if all
Requirements Description:1, the current directory has a lot of folders, files, statistics/usr/local/This directory, if it is a folder, to delete/usr/local/F1 W1 F2 W2 W3 W4 F4W1 W2 W10.txtRequirements Analysis:1, first list all the files in the directory, with Os.listdir ()2, determine if it is a file, Os.path.isfile ()ImportOsf_dir=OS.GETCWD ()#Get current directoryL_dir=os.path.join (F_dir,'usr\local')#stitching into full usr/local pathLis_dir=os.listdir (L_dir)#list all the files in the direc
# 1, write a password-generating program,# Number of inputs, the number of times to generate the number of data,# Require password must contain uppercase letters, lowercase letters and numbers, 8 bits in length, cannot be duplicated1 Importstring, Random2Num=input ('Please enter a number'). Strip ()3pwds=set () #定义一个空集合4 ifnum.isdigit (): #判断是否为数字5I=06 whileLen (PWDs) int (num):7Passwd=set (Random.sample (string.ascii_letters+string.digits,8))8set1=set (string.ascii_uppercase). Intersection
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.