07: Funny Jumps
Total time limit:
1000ms
Memory Limit:
65536kB
Describe
An "interesting jump" in a sequence of length n (n>0) is currently only available when the absolute value of the difference between adjacent elements is sorted from 1 to (n-1). For example, 1 4 2 3 has a "fun jump" because the absolute value of the difference is 3,2,1. Of course, any sequence that contains only a single elemen
09: Vector dot Product calculation
Total time limit:
1000ms
Memory Limit:
65536kB
Describe
In linear algebra and computational geometry, the vector dot product is a very important operation.
Given two n-dimensional vectors a= (a1,a2,..., an) and b= (B1,b2,..., bn), find dot product a· b=a1b1+a2b2+...+anbn.
Input
The first line is an integer n. 1 The second line cont
prefixes from this leaf nodeUntil it is not found, and then the word as a new leaf node grows on the current nodeThis will optimize a lot ofEasy ACCome on, on the code:#include #includestring>#include#include#defineMoD 10000007using namespacestd;structNode {int from, To,dis,next;};structNode edge[100001];intn,len[100001],hash[100001][Wuyi],dp[100001];inthead[100001],num,ans=0;stringword[100001];inlinevoidEdge_add (int from,intTo ) {num++; Edge[num].to=to ; Edge[num]. from= from; Edge[num].nex
This question tells me two reasons:1. Remember to write a case or hang your dead.2. When the data is very water, only examples of this kind of situation ...The original data can be so water ...1#include 2#include 3#include 4#include 5#include string.h>6#include string>7#include 8#include Set>9#include Ten#include One #defineM (A, B) memset (A,b,sizeof (a)) A using namespacestd; -typedefLong Longll; - intMain () { the intt,case_=1; -scanf"%d",T); - while(t--){ -printf"Case #%d:", case_+
of zerosOutputfor each test case output one line consisting of the "test case" number followed by the minimal number of radar instal Lations needed. "-1" installation means no solution for this case.Sample INPUT3 2 1 2-3 1 2 1 1 2 0 2 0 0Sample outputcase 1:2 Case 2:1: First conversion to interval points, then sorting, the interval to find points; code:1#include 2#include 3#include 4 using namespacestd;5 structnode{6 Doubles,e;7 };8 intn,d,k;9Node area[1010];Ten intCMP (Node A,node b) { One
To find the product of odd numbersTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 56573 Accepted Submission (s): 36490Problem Descriptiongive you n integers and ask for the product of all the odd numbers in them.InputThe input data contains multiple test instances, one row per test instance, and the first number of each row is n, indicating that there is a total of n for this group of data, followed by n integers, you can assume that each set o
Reprinted please indicate the source, thank youHttp://blog.csdn.net/acm_cxlove/article/details/7854526By --- cxlove
Give an interval and ask how many numbers in the interval do not contain digits 0, and at least once A or B appears.
Http://acm.bupt.edu.cn/onlinejudge/newoj/showProblem/show_problem.php? Problem_id = 652
Since there are only two mode strings, A and B can actually be matched directly, although I won't
I still need to use the AC +
numbers separated by a space, if a website contains a virus, the number of viruses will not exceed 3.The last line of output statistics, the following formatTotal: Number of sites with virusesThere is a space after the colon.Sample Input3aaabbbccc2aaabbbcccbbaaccSample OutputWeb 1:1 2 3total:1Pit Ah, visible character 32-126 ...Idea: Use the word[] array to record the number of the virus string.AC Code:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master pe
#include#include#includeUsingnamespace Std;struct person{Char name[10];int Age,money;} p[100010];BOOL CMP (person A,person b) {if (A.money!=b.money)Return a.money>b.money;Elseif (a.age!=b.age)Return a.ageElseReturn strcmp (A.name,b.name) 0;}int main () {int n,k; scanf"%d%d", n,k);Forint i=0; I"%s%d%d", p[i].name, p[i].age, p[i].money);} Sort (p,p+n,cmp);Forint t=1; TQuery k times {int cnt=0,qpeople,qyoung,qold;Output record CNT, output query maximum number of people, minimum age, maximum age sca
Topic Link: RingParsing: M-valued strings, the value of the string s in the string str = the number of times XS appears in Str. Ask what is the most valuable string of length n.The subject needs to output the smallest dictionary orderIn DP, open an array to record the results.AC Code:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. HDU 2296 Ring (ac automaton + DP)
Title Link: Wireless PasswordParsing: A set of M words that counts the number of programs with at least K words in a string of all lengths of N.AC Automaton + state compression DP.DP[I][J][K]: String of length I matches to status J and contains the number of possible strings for K magic word.AC Code:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. HDU 2825 Wireless Password (AC autom
1 secondsMemory limit:32 MBSpecial question: Nosubmitted:4466Resolution:1375
Title Description:
The
number of the mass factor for a positive integer N (n>1). The same quality factor requires repeated calculations. such as 120=2*2*2*3*5, a total of 5 qualitative factors.
Input:
There may be multiple sets of test data, and the input to each set of test data is a positive integer N, (1
Output:
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.