#include#include#include#includeUsingnamespace Std;int n;String Deal (String S,int e)"Thinking" 1: Absorbing excess 0:. 2: Find "." Judged with a size of 1. 3: Remove "." The 10 index (plus or minus is related to Step2) {4: To determine whether the deletion is finished, the deletion indicates that the number is 0. 5: Deposit The first n numbers, less than 0 complement. Returnint k=0;while (S.size () >0 s[0]==' 0 ')Absorption. 0 S.erase (S.begin ()) in front of the excess;if (s[0]==‘.‘)Situation
Leftmost DigitTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)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 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 leftmost digit of n^n.Sample Input234 Sample Output22Analysis:
Topic: Given a tree has a root, each operation can make an edge right +1, the minimum number of operations, so that the root node to each leaf node distance is equalTree-shaped DPAn easy-to-find operation is more advantageous for edges closer to the root nodeFirst, sweep through each node the maximum distance from the node to all the leaf nodes in the subtree and enumerate each son to make the Benquan between the node and the son equal to the maximum distance.This is done for each node to ensure
the highest cardinality.To x^x the logarithm, x* ln (x)/ln (10), it is assumed that the value is X.ABCDEEFG so 10^x is the highest corresponding weight, 10^ 0.ABCDEFG is the highest cardinality. Note that what you get here is not an integer, why? Because here is the force of the next bit of the value is also converted to the highest level up, which is a bit like the large number, if the system is not satisfied with the forced carry, it is obvious that it will be in the high one decimal rather t
Set A to a prime number, modulus to another prime, and then the answer to the polynomial of violence, and if the answer is equal, the two polynomial are considered equal.This kind of hash has the error probability question why still must use the hash? Because the probability of error is too small, a and modulus of the value of the person can not get a good card.And then contributed 2 times WA, for the first time because the number is not judged by the boundary, the second time because the multip
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 a single integer T which is the number of test cases. T test cases follow.
Each test case
Test instructions: Given a number n, lets you find the nth number of N of the first digit.Analysis: A look at this n fast to int limit, it is obvious can not do directly, to transform a bit. Since this is an index, we can take down the index.That is, to take the logarithm, set ans = n ^ n, on both sides take 10 as the base logarithm of lg (ANS) = n * LG (10), and then this integer part is 10 multiple parties,No use, that is to say we want the small number of parts, and then take the index, OK. A
])Continue; if(sum[i]>H[i])return 1; if(sum[i]H[i])return-1; } return 0;}intMain () {intt,d; scanf ("%d",t); while(t--) {memset (H,0,sizeof(h)); memset (SUM,0,sizeof(sum)); //depositing the information of the F-polynomial into the F-arrayscanf"%d",d); LF=d-1; for(intJ=LF; j>=0; j--) {scanf ("%d",F[j]); } //The G-polynomial information is stored in the G arrayscanf"%d",d); LG=d-1; for(intJ=LG; j>=0; j--) {scanf ("%d",G[j]); } //The H -polynomial information is stored in the H
an integer type of data that has no definite specification. In today's mainstream compilers, support for the 64 integer is also standard and varies in form. In general, 64-bit integers are defined in long long and __int64 two (VC also supports _int64), while output to standard output is printf ("%lld", a), printf ("%i64d", a), and cout There are a few more:
A long long definition can be used for gcc/g++, not platform-limited, but not for VC6.0.
__int64 is the definition of the
Pointpos to do a comparison, if the former small, the description is greater than 1 of the number, Pointpos-firstpos is 10 of several Parties; if the latter is small, the description is a decimal, should be used Firstpos-pointpos + 1,+ 1 is because the Firstpos crosses the decimal point, and the decimal point is not counted as one, note that this is a negative value.When the ④ is equal, it is equal if the cardinality part is consistent and the sub-party is identical.The code is as follows:#incl
}{2}f_{v,j}\) . \ (2\) , assuming \ (j=i\) , obviously the legal process should be like this: \ (v\) originally had \ (size_v-1\) edge, if left \ (i\) bar, you should remove \ (size_v-1-i\) edge, and \ (u\) to \ (v\) should also be deleted along with the deletion of those edges, considering the deleted \ (size_v-1-i\) bars, \ (u\) to \ (v\) can be inserted into \ (size_v-i\) Any one of the empty spaces (because both ends are also available). At the same time we can see that when the l
[ERROR] Apache2.2:service is already installed.
(OS 1060) The specified service is not installed. : Apache2.2
The above two errors can generally be resolved by reinstalling Apache in the following way
Tip Apache has already been installed.
Open the service, describe the sort, find the service that contains the Apache word to judge is not previously loaded with other software comes with Apache, uninstall.
If the software with Apache is uninstalled, but
// This question has never been stuck before, and it takes a night to get through it. // This question is about topological sorting. When there are several error points/topological sorting, m each time, ensure that there is only one entry point of 0,
Take the logarithm, then obtain the fractional part, and then calculate the power, OK
The Code is as follows:
[Cpp]# Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include #
Problem Description
Given a positive integer N, you should output the leftmost digit of n^n. Input
The input contains several test cases. The ' the ' of the ' input is ' a single integer T which is the number of test cases. T test Cases follow.Each
leftmost Digit Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Problem Description Given A positive integer N, you should output the leftmost digit of n^n.Input the input contains several test cases. The ' the ' of the '
Problem Description Given A positive integer N, you should output the leftmost digit of n^n.
Input the input contains several test cases. The ' the ' of the ' input is ' a single integer T which is the number of test cases. T test Cases follow.
Each
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.