Transmission Door
Just now I was depressed online how no one used $cdq$ to doSuddenly found there is no time sequence ....#include #include#include#include#includeusing namespacestd;Const intn=3e6+5; inlineintRead () {CharC=getchar ();intx=0, f=1; while(c'0'|| C>'9'){if(c=='-') f=-1; C=GetChar ();} while(c>='0'c'9') {x=x*Ten+c-'0'; C=GetChar ();} returnx*F;}intN,q,c[n],mp[n];intm,qid;structoperation{intX,y,v,id; intQid,op; Operation (): OP (0)
The simplest example of using mediaplayer to play audio or video:Java code:
Public class mediaplayerstudy extends activity {
Private button bplay, bpause, bstop;
Private mediaplayer MP = new mediaplayer ();
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
Bplay = (button) findviewbyid (R. Id. Play );
Bpause = (button) findviewbyid (
I learned the KM Algorithm in Baidu encyclopedia ..
The KM algorithm is the maximum weight for a complete match.
KM algorithm flow:
1. initialize two vertices of a bipartite graph.
2. Search for complete matching using the Hungary algorithm using the KM Algorithm
3. Modify the vertex value if not found.
4. Repeat (2) (3) until a complete matching of an equal subgraph is found;
HDU 2255 is a bare question ..
Unoptimized version:View code
#include#include#includeint match[1000];int
indicates that the Service and UI (Activity) are not executed in the same process, but are executed in different processes.
2. The Android Application starts and stops the Service in the Activity.
3. The override onStart () method is started in the Service to execute the desired background function.
4. When the onDestroy () method is stopped, the background function is stopped.
The specific implementation of the Service is as follows:
[Java] package com. android;Import java. io. IOException;Imp
Test instructions: give you n lines, ask you how many of these segments can be composed of rectangles and the maximum. Each line segment can be-1,.Problem-solving ideas: greed.Problem Solving Code:1 //File name:d.cpp2 //Author:darkdream3 //Created time:2015 March 27 Friday 16:05 31 seconds4 5#include 6#include 7#include 8#include Set>9#include Ten#include One#include A#include -#include -#include the#include -#include -#include -#include +#include -#include + #defineLL Long Long A at
up with boys who have never had a fight with them. 2. diagram .. 0 is the source point, 2 * n + 1 is the girl number of the sink point is 1-N, the boys' number is n + 1-2 * n. The Edge Weight of a boy who has not had a quarrel with him is 10-(1-n). The Edge Weight is mid .. (N + 1-2 * n) to 2 * n + 1 structured Edge Weight mid as to the mid value, then the binary search .. The value range of mid is [0-N]. Why n .. You can play up to N games as required. Assume that the final network stream is N
, the fileinputstream class in the Java. Io package can complete this work, which is very simple. See the Code:
BMP = bitmapfactory.Decodestream(NewFileinputstream ("/sdcard/graphics/player1.png "));
Note that the file path must be correct. to access the file in sdcard, use "/sdcard/" as the root directory. Of course, bitmapfactory also has a simpler decodefile method. You can try it yourself.
Next, let's complete the second part of this chapter and play an audio file stored in the Assets Direct
HDU 4711 Weather probability DP
A person has stayed in a certain area for n days. There are m places in this area, and there are w kinds of weather conditions. First, give the daily weather of the person's itinerary, then the probability from place I to place j can also be given to itself, and the probability that a place is a certain weather is given, ask you where the person is most likely to travel, that is, where he stays every day,
Probability DP, find out which routes have the highest prob
# Include # Include # Include
// This struct is used to represent other vertices that can be reached from a vertex.Struct Enode{Int secpoint; // vertex numberEnode * Next; // pointer to the next Vertex};
// This struct indicates the information of each vertex.Struct pnode{Char value; // vertex ValueInt indegree;Int outdegree;Enode * Next; // pointer to the other first vertex that can be reached by the vertex};
// Structure of the graph, which has a maximum of 100 verticesStruct Map{Pnode
Original article: http://blog.ftofficer.com/2009/12/python-multiprocessing-3-about-queue/
Continue to discuss Python multiprocessing. The main content of this discussion is queue, one of the core components of the MP library.
Queue is a method in the MP library that provides multi-process Object Exchange. Object switching and the previous partThe object sharing mentioned in this document is to allow multi
Title Link: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3861Test instructions: Gives a set number of possible sliding sequences that require this set of numbers to be unlocked at the interface.Idea: According to whether the map can be directly reached, such as 1 can be directly to 2, but 1 can not be directly to 3, because the middle must go through a 2.Note that if 2 has been accessed, then 1 can be directly to 2.Build DFS, figure to update.1#include 2#include 3#include 4#inclu
Test instructions: Give you a tree, each node has a value, 3 kinds of operations1) Q u ask for the value of a certain point.2) I U v W put the value of all points between u,v (including u,v) plus W3) D u v w subtract the value of all points between u,v (including u,v) minus WProblem-solving ideas: Tree chain, tree-like array records change the value of a bit faster than the segment tree.Problem Solving Code:1 //File name:3966.2.cpp2 #pragmaComment (linker, "/stack:1024000000,1024000000")3 //Auth
-1AuthorlinleSource 2008 Zhejiang University Postgraduate second-round warm-up (2)--Full true simulation topic Link: http://acm.hdu.edu.cn/showproblem.php?pid=1874 Analysis: Floyd board problem, concrete will do after the detailed, The main function of the Floyd is only 4 lines, as follows:1 for (int k=0; k) 2 for (int i=0; i) 3 for (int j=0; j) 4 Mp[i][j]=min (Mp[i][
few decisions. My wardrobe is full of blue shirts for the same reason. I used to have two shades of shirts, blue and magenta. I think there are too many decisions that need to be made. (laughter) So now I only wear blue shirts.Q: You urge policymakers to take the time to think about a future scenario in which a large part of human work is being computed and robots cut. Do you have any way out?A: This is a very difficult question. The computer excels at the repetitive work of machinery. So far,
The following method was used when libmedia was used in android4.0.4: [cpp] # define SYSTEM_BOOTMUSIC_FILE "/system/media/sound.ogg" int index; MediaPlayer * mp = new MediaPlayer (); if (access (SYSTEM_BOOTMUSIC_FILE, F_ OK ))! =-1) {if (mp-> setDataSource (SYSTEM_BOOTMUSIC_FILE, NULL) = NO_ERROR) {mp-> setAudioStreamType (AUDIO_STREAM_ENFORCED_AUDIBLE);
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.