Topic 1049 string to specific character 9 degree Online JudgeDescription:
The input string s and character c must be removed from all the c characters in s and output results.
Input:
There are multiple groups of test data, with each group of input strings s and character c.
Output:
For each group of inputs, the output results after the c characters are removed.
Sample input:
healloa
Sample output:
hello
Method 1:
# Include
# Include
Usin
#include #include Standard library for the Char s[10000],n,i;int cmp (const void *a, const void *B)//From small to large do not join formal parameters{Return (* (int *) a-* (int *) b);}int comp (const void *a,const void *b)//from large to small{Return (* (char *) b-* (char *) a);//By changing the type to match the sort of int or char}int main (){scanf ("%d", n);GetChar ()//Sort string to prevent the carriage return symbol from being absorbedfor (i=0;iscanf ("%c", s[i]);Qsort (S,n,sizeof (s[0]),
for the K-remainder), there must be duplicate values,At this point, r-f[t] is the cycle T, that is, we take the T-bit x forward, the result of the K-remainder is still t, so we just need to do it again (M-f[t])%T(t*10+x)%k operation, which greatly reduces run time#include #definell Long LongintOK (intX,ll m,intKintc) { intf[10000] = {0},r,t=0, left; for(r=1; r) {T= (Ten*T+X)%K; if(F[t]) { left= (int) ((M-f[t])% (rf[t])); while(left--) {T= (Ten*T+X)%K; } returnt = =C; } F[t]=R; }
l2-005. Set similarity time limit MS Memory limit 65536 KB code length limit 8000 B award Program StandardAuthor ChenGiven a collection of two integers, their similarity is defined as: nc/nt*100%. Where NC is the number of unequal integers in all two sets, NT is the number of unequal integers that have a total of two sets. Your task is to calculate the similarity of any given set.Input format:Enter the first line to give a positive integer n (The line then gives a positive integer k (Output form
Title Description: Give you two vectors of the same size a B, to find their cosine similarity; returns 2.0000 if the cosine is similar to a non-method (e.g. A = [0] B = [0]).Example: Given a = [1, 2, 3], B = [2, 3, 4].Returns 0.9926, given a = [0], B = [0]. Returns 2.0000Python calculates this kind of data science is juchongruoqing, even without any third-party library, can be very concise code to complete the operation.Calculating the cosine of two vectors is an important method to judge the si
results, so this piece of waste too much brain cells, wrote the old long stored procedures. Source Downloadjust said that the more complex part of the questionnaire is the topic of the addition of the editing section, the interaction of this part of the effect of the following. We're going to open up this part of the interactive source, which is helpful for small partners who want to improve on the front end. Of course, the great God of the front can ignore this paragraphClick here to download
Title Description:
A program that reads a string of first-order traversal strings of user input and establishes a binary tree (stored as a pointer) based on this string.For example, the following is an ordinal traversal string:abc# #DE #g# #F # # #Where "#" represents a space, an empty characters represents an empty tree. After this binary tree is established, the sequential traversal of the two-fork tree is performed, and the output traversal results are obtained.
Topic 1083: Special multiplication
time limit:1 seconds
Memory limit:32 MB
Special question: No
submitted:2910
Resolution:2027
Title Description:
Write an algorithm that evaluates to 2 inputs that are less than 1000000000.
Special Multiplication Example: 123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5
Input:
Two a number less than 1000000000
Output:
not difficult to understand, we assume x = KY + R (we consider r > 0, there will be rounding occurring), then there is.└ (x+y-1)/y┘=└ (ky+r+y-1)/y┘= K +└ (r+y-1)/y┘= K + 1You can see that after doing this processing, that is, the X plus y-1 offset, at this time in the rounding, the result will be added 1 on the original basis. This is exactly what "biasing" means, and it will round out the rounding "offset".Here we will complement the division of the program in this way to fix it, see if this i
The name of the beautiful degree =26* the number of letters +25* the number of letters followed by the number of +24* letters followed by the second (ignoring the case) +....+1* the smallest occurrence.Input: integer n,n a stringOutput: n string of beautiful degreesFor example:Input 1 AOutput 26C#include #include #include #include using namespace STD;BOOLcmpintAintb) {returnA>b;}intMeili (Const stringAMP;STR) {inta[ -]={0};intlen=0, POS; for(intI=0; I
a bit result = Capture_job.result Grabber.stop () If Result:rospy.loginfo ('%s:succeeded, [%s] Images.\nresult:%s '% (Self._action_name, Result.n_captures, R Esult)) Server.set_succeeded (Result) Self._capture_job = None 16th, 17 line display while listening to wait "Image_color" "camera_info" two topic, they are OPenNI2 published image data, see Imagegrabber code Discovery, inside is in sync wait two Topic trigger the camera operation (message_filters) when there is data at the same time. Time
lis (not strict): first I think of the LIS, but always feel a bit wrong, each number minus its subscript, to prevent the following situation: (reprint)3 The join sequence is 1,2,2,2,3, so that the ascending sub-sequence is 3, that is, to modify 2, but the middle of two 2, the range of changes can not exceed (1,3)4 then it is wrong to ask, but after the loss, it is equivalent to the number of repetitions in the middle left the room for modification .5 explain why it can be reduced and remain corr
Title: Click to open linkCode:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Hdu OJ 18,696 degree separation
Title Description:
Enter a sequence of two integers, and the first sequence represents the stacking order of the stack, judging whether the second sequence is the pop-up order for the stack. Assume that all the numbers that are pressed into the stack are not equal. For example, the sequence 1,2,3,4,5 is the indentation order of a stack, and the sequence 4,5,3,2,1 is a pop-up sequence corresponding to the stack sequence, but 4,3,5,1,2 is not likely to be the pop-up sequence of the
there is only one vertex in all vertices with zero in degrees;
The code is as follows:
#include #include #define N 1001struct Node {Char name[100];int indegree;}nodes[n];int main () {int n;while (scanf ("%d", n)! = EOF n! = 0) {Char str1[100];Char str2[100];int count = 0;for (int i = 0; i scanf ("%s%s", STR1,STR2);int f1 = 0,F2 = 0;//f1 represents the winner, F2 represents the loserfor (int j = 0; J if (strcmp (str1,nodes[j].name) = = 0) {F1 = 1;}if (strcmp (str2,nodes[j].name) = = 0) {NOD
. You can then go back to the first page to insert the page number of the place double-click, the page number is deleted , then the first page and the second page the page number disappears. Of course, if you want to insert the page number of other symbols in the first page without the page number, just use the first case as described above, and he has no effect on the page number starting on the third page, so you can insert the page numbers in other symbols in the document starting at the thir
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.