View code
Core: (from neopenx, orz)
1 int dfs(int len,int remain,bool fp) 2 { 3 if(!len) return remain==0?1:0; 4 if(!fpdp[len][remain]!=-1) 5 return dp[len][remain]; 6 int ret=0,fpmax=fp?digit[len]:9; 7 for(int i=0;i
Len: the number of digits currently scanned, from high to status
Remain: indicates the current status. As shown in this question, from the highest digit to the curre
When I went to the supermarket to buy things, the product with a price of 2.99 yuan always seemed to be more popular than the product with a price of 3 yuan. People in the marketing circle call this "left-digit effect ". It is said that when people shop, they only pay attention to the leftmost Number of the price tag. As long as the number is within their own scope, the subsequent number will not be too concerned.
A new study, published in the latest
Fast computing of 1 digits in 32 digits
Sailor_forever sailing_9806@163.com reprint please note
Http://blog.csdn.net/sailor_8318/archive/
2008/10/12
/3059935. aspx
A statement is used to determine whether X is a power of 2.
# Define is2 * n (x) (X (X-1 ))? 0: 1)
Int main (void)
{
Int M = 512;
Cout
// That is, when only one digit in M is 1, it is several power values.
// If there are two or more 1 s, the (M (m-1) value is n
Topic Links:http://acm.hdu.edu.cn/showproblem.php?pid=1061Topic Type:Water problemTest Instructions Summary:n the number of bits in the nth order.Problem Solving Ideas:Because the range of n is too large, so I pass the number of bits to 1-9 to make 20 times to hit the table, found that their cycle is not 4, is 4 factor, so I have a number of digits 1-9 for the table four times, and then the number of input only to determine the number of single digits, and then judge the number in the first few
13-digit number, like the result of the Date.gettime () function, such as 1378049585093. After study, in 2013, the first three digits were 137, 2023 was 168, and 2033 was only 199. So, I decided the first digit 1 can be removed, not occupy the position. It is certain that most systems will not be used for 10 years and 20 years. In this way, parameter 2 becomes a 12-dig
Find rule!
N! The last Non-zero-digit value. For example, 2 is the last value of 120 instead of 0.The input N is larger than the limit value and must be saved in large numbers.Note that the number of the last 0 is equal to the number of five factors. Set F (n) to n! .Then f (n) = (N % 5 )! * F (N/5) * 2 ^ (N/5) % 10The number of factor 2 is always greater than 5. Each of the five consecutive groups is divided into one group starting from 1. The multip
Hdu oj 1061 Rightmost Digit (fast power algorithm), hdurightmost
Here we will first explain the quick power algorithm:
Fast modulo Algorithm
I have not found a detailed description and explanation of the quick power algorithm on the website. Here, I provide a complete explanation of the quick power algorithm, using the C language, readers of different languages have to change their positions. After all, many people read C ~
The so-called rapid power
Label: Print 1 to the maximum n digits Description: Enter the number N and print the n-digit decimal number from 1 to the maximum in order. For example, if you enter 3, the number of three digits from 1, 2, and 3 to the maximum is 999. Analysis description: The first thought is to first calculate the maximum N-digit number, and then print it from 1 to the maximum N-
Hdoj Address: http://acm.hdu.edu.cn/showproblem.php?pid=1061Fast Power algorithm Explanation: http://blog.csdn.net/qq_26891045/article/details/51334101Rightmost DigitTime Limit: -/1 theMS (java/others) Memory Limit:65536/32768K (Java/others)Total Submission (s):45746 Accepted Submission (s): 17221 problem DescriptionGiven A positive integer N, you should output the most right digit of n^n.InputThe input contains several test cases. The first line of
A friend encountered a problem during the interview, write programs in Java, calculate two 20-digit multiplication. Listen, it's funny, just try to make it.The idea is to use code to simulate the process of multiplying the hand, that is, the multiplication of a bit, the result remains on the corresponding bit, and the rounding problem is solved.Ask if the other side is solved, the other side told me that Java has a Java.math.BigInteger package, there
Title Link: http://vjudge.net/problem/HDU-1061This topic requires n-n multiplication of bits, the direct result of a positive data overflow.In fact, as long as each time a number to retain the digit and n multiplied on it,Because A*b=c, for the single digit, A (digit) *b (digit) =c (
HDU 1060 Leftmost Digit (number theory)
Leftmost Digit
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission (s): 13680 Accepted Submission (s): 5239
Problem DescriptionGiven a positive integer N, you should output the leftmost digit of N ^ N.
InputThe input contains several test cases. The first line of the input is
1107:0 start-up algorithm 14--three-digit reversal time
limit:1 Sec Memory limit:64 MB 64bit IO Format:%lldsubmitted:4915 accepted:2378[Submit] [Status] [Web Board]
DescriptionWater problemInputEnter a 3-digit number (the title contains multiple sets of test data)OutputSeparates the 3-digit hundred, 10-bit, and single-
) Memory limit:65536/32768 K (java/others)Total submission (s): 35199 Accepted Submission (s): 13362Problem Descriptiongiven A positive integer N, you should output the most right digit of n^n.Inputthe input contains several test cases. The first line of the input was a single integer T which is the number of test cases. T test Cases follow.Each test case is contains a single positive integer N (1Outputfor Each test case, you should output the rightmo
In html, color represents the most commonly used 6-digit hexadecimal code notation. In addition, color can also be represented by rgb (r, g, B). r, g, B Represents red, green, and blue in decimal number or percentage from 0 to, respectively. If you are interested, you can see that there are 3 Representation Methods in the HTML, the most commonly used is the 6-digit hexadecimal code notation. For example, bg
Php graphic digit Verification Code
All of the following code has been debugged by myself. Run authpage. php./** Filename: authpage. php*/Srand (double) microtime () * 1000000 );// Verify that the user input is consistent with the verification codeIf (isset ($ _ POST ['authinput']){If (strcmp ($ _ POST ['authnum'], $ _ POST ['authinput']) = 0)Echo "Verification Successful! ";ElseEcho "Verification Failed! ";}// Generate a new four-
Rightmost DigitTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 39554 Accepted Submission (s): 14930Problem Descriptiongiven A positive integer N, you should output the most right digit of n^n.Inputthe input contains several test cases. The first line of the input was a single integer T which is the number of test cases. T test Cases follow.Each test case is contains a single positive integer N (1Outp
Using pointers in C language to implement two-digit Interchange (Code tutorial)Using pointers in C language to implement two-digit swaps (Code tutorial)
/* Time: February 5, 2018 00:39:34 question: C language two-digit Interchange (with pointer) Objective: To understand the meaning of the pointer, and will use */# include
Int swap (int *, int *); // functi
Php code to generate a random six-digit password
// Generate a six-digit password Begin at random
Function randStr ($ len = 6, $ format = 'all '){
Switch ($ format ){
Case 'all ':
$ Chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 -@#~ '; Break;
Case 'char ':
$ Chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
PHP introduces two functions that implement the digit zero filling function. In PHP, there are at least two functions that can help us quickly implement zero-padding: The first is the PHPstr_pad function: Copy the code as follows: # str_pad-use another string to fill in characters. there are at least two functions in PHP that can help us quickly implement zero padding:
The first is the PHP str_pad function:
The code is as follows:
# Str_pad-use anot
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.