Http://poj.org/problem? Id = 2478
Evaluate the template of the Euler function.
When it comes to Euler's function, first learn its basic nature.
1. Euler's function is the number of positive integers less than n and with n (including 1. It is recorded as PHI (n ).
2. Euler's theorem: If a interacts with n, there is a ^ PHI (n) ≡ 1 (mod n), which is often used for power modulo.
3. If p is a prime number, then PHI (p) = p-1, note that Phi (1) = 1.
4. th
(Hdu step 8.1.7) Gifts for yu'e (basic use of stacks-evaluate the number of '(' before a specific character), hdu8.1.7
Question:
A gift for the Fool's Day
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission (s): 49 Accepted Submission (s): 44
Problem Description April 1 is approaching. Vayko thought of a good way to give gifts to fools. Hey, don't think too we
Evaluate the java array to the greatest value.
In java, the array is the best value, which is rarely used in actual development, but will be occasionally asked during the interview. This is your basic thinking ability. Now let's talk about the basic idea of this question.
Ideas:
1: Define a variable first. Generally, the first value of the array is used.
2: in the loop, determine whether (from the second badge to the value corresponding to the length
Urgent: after sorting array 1-> array 2, evaluate the algorithm! 3Q Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061215205531143.html
Sort array 1 and save the sequence number values before array 1 to array 2 in the order of sorting. This is a simple algorithm (with less code and second speed)
Example:
A [0] = 4
A [1] = 5
A [2] = 3...
A [1] maximum, A [0] Second, A [2] third
Take the original sequence number of A-> B
B
POJ2387 evaluate the negative weight
This is a farm with F magical farms.The farm has N points, M roads, and W wormhole holes. The worm hole can trace back the time.Ask if you can start from a certain point and return to the origin through the path and the wormhole hole. The time is earlier than the original time.
My first thought was to use the bellman-ford algorithm to determine whether there was a negative weight.I submitted a few wrong requests. I
Thompson developed the first UNIX shell named V6 shell in 1971. Similar to its predecessor in Multics, this shell (/bin/sh) is an independent user program executed outside the kernel. The concept of globbing parameter extension pattern matching, such as *. txt) is implemented in an independent utility named glob, just like the if command used to evaluate the conditional expression. This independence can keep shell small. For less than 900 lines of C
Evaluate all subsets of a set.
Today, I went to the interview and came back to say that one of the questions was to output all the subsets of a set. on the rise, I searched for them on the internet and summarized them as follows:
Two methods:
1)Recursive Implementation
Assume that the function for generating all subsets of a set is F. F (, 5) is composed of two possibilities: (1) F is applied to a set of elements other than 1; (2) apply F to a set of
Idea: 1. (prime number filtering theorem) n cannot be divisible by any prime number not greater than root number N, then n is a prime number.2. Even numbers except 2 are not prime numbers.The Code is as follows:/*** Calculate the prime number in N * @ Param int $ N * @ return array */function get_prime ($ n) {$ prime = array (2 ); // 2 is the prime number for ($ I = 3; $ I Evaluate the prime number within N (definition of prime number: in a natural nu
/** Copyright (c) 2012, School of Computer Science, Yantai University * All Rights Reserved. * file name: test. CPP * Author: Fan Lulu * Completion Date: July 15, December 18, 2012 * version: V1.0 ** input Description: none * Problem description: Evaluate the string length with the pointer and return *ProgramOutput: String Length * Problem Analysis :*AlgorithmDESIGN: slightly */# include
Evaluate the prime number using the 'distinct' Method I. Method for prime number calculation:The factor of one number N does not exceed SQRT (n ). The Code is as follows: C/C ++ code # Include This method is only applicable to N hours, which is too time-consuming when n is large. 2. The method for filtering prime numbers is not to directly judge whether a number is a prime number, but to remove all the numbers that are not prime numbe
Question] ComputingReverse polish expression(Also called a suffix expression) value. For example: ["2", "1", "+", "3", "*"]-> (2 + 1) * 3)-> 9 ["4 ", "13", "5", "/", "+"]-> (4 + (13/5)-> 6 [Idea] Store the operands in one stack. When the operands are pushed directly into the stack, the operators take out the two operands at the top of the stack for calculation, and then place the calculation results into the stack. [Java code] Public class solution {public int evalrpn (string [] tokens
tag: OS Io SP amp C IOS as R return # include
using namespace STD; int find2 (int A [], int N) {int high = n-1; int low = 0; int mid; while (A [High]
= value) {LOW = Mid + 1 ;} else {high = low-1 ;}} return (A [Mid] = value )? Mid:-1;} int main () {int A [] = {,}; cout
Evaluate the minimum value of the rotated ordered array and search for it in the rotated Array
Problem description: Evaluate the value of an arithmetic expression in reverse Polish notation. Valid operators are+,-,*,/. Each operand may be an integer or another expression. Solution: 1 Public Int Evalrpn (string [] tokens ){ 2 Stack New Stack (); 3 For ( Int I = 0; I ){ 4 If (! (Tokens [I]. equals ("+") | tokens [I]. equals ("-") | tokens [I]. equals ("*") | tokens [I]. equals ("/" ))){ 5 Operands. Push (t
【Evaluate the reflection Vector]Returns the input ray vector I and the plane normal vector N, and returns the reflection vector R, as shown in. For easy computing, we assume that I and n are all units vectors (Modulo is 1, and I and N can be unitized first during programming ).Set the angle between the incident light vector I and the normal vector N on the reflection plane to Theta. The start end of the connection I and the end of the RR = 2 p-I (1)No
[Question]
Evaluate the value of an arithmetic expression in reverse Polish notation.
Valid operators are+,-,*,/. Each operand may be an integer or another expression.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
Question]
Calculates the value of an expression in reverse Polish notation.
[Idea]
The inverse Polish formula is actually a binary tree traversal.
Use the stack to
Directory 1: n idea of divide and conquer x 2. Content of C ++ Code 1. n idea of divide and conquer x T (n) = divide (lgn) in order to calculate the multiplication number a ^ N, the traditional method (called naive algorithm) is to multiply n times cyclically, and the algorithm efficiency is round (n ). However, if the division and control method is adopted, the algorithm efficiency can be improved to lgn, as shown in the following figure.
2. c ++ code for power. h
1 # ifndef power_hh 2 # define
# DEFINE _ crt_secure_no_warnings# Include Int main (){Int m = 0, n = 0, x = 0, y = 0;Int I = 0, Count = 0;Printf ("Enter M and N: \ n ");Scanf ("% d", M, N );For (I = 0; I {X = (M> I) 1; // assign the value of I + 1 in the binary of m to XY = (n> I) 1; // assign the value of I + 1 in the binary of N to YIf (X! = Y) // judge whether X and Y are equalCount ++;}Printf ("M and N have % d digits different \ n", count );
System ("pause ");Return 0;}
This article from the "Zero Time" blog, please
Evaluate a regular expression to remove 000 after the decimal point, for example
8.38370000
The result is 8.3837.
8.0038370000
The result is 8.3837.
8.38370010
The result is 8.3837001.
Reply to discussion (solution)
$ S = 8.3837
8.3837
8.3837001
It is unreasonable to change 8.0038370000 to 8.3837.
$ String = "8.38370010"; echo (float) $ string;8.3837001
Preg_replace ('/[^ 0] 0 + $/', ', $ s); it is unreasonable
Evaluate a regular expression and another regular expression or test method. (Not enough !) Regular Expression number
The younger brother asks God to give a regular expression and another regular expression or test method, the specific situation is:
1. there is
For such input, the user is required to enter the date in the format of 9: 08,14: 54. Note that the hours can be one or two digits.
In this case, how do I write a regular expression? And how
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.