Input n
N Max. Min.
Input
5
1 5 2 3 6
Output
1 6
#includeView code
# Include # Include Using namespace STD;Int main (){Int N, I, a [1000];While (CIN> N){For (I = 0; I Cin> A [I];Sort (A, A + n );Cout }}
#includeView code
# Include
# Include
Using namespace STD;
Int main ()
{
Int N, I, a [1000], M1, M2;
While (CIN> N)
{
For (I = 0; I
Cin> A [I];
If (I = 0) M1 = m2 = A [0];
If (A [I]>
This problem requires us to find two non-negative numbers M1 and M2 that satisfying
N1 * m1 + N2 * M2 = N
And minimize the cost
C = C1 * m1 + C2 * m2.
First, we can use extended Euclid's algorithm to find M1 'and M2' that give
N1 * m1 '+ N2 * M2' = G
Where G is the greatest
Define a King Glory member class Moba,Its private data members have a blood volume of blood (initially 100), Attack Fire (initial 15), Defense defend (initial 10), sum of members already created (initialized to 0),Public function members include eating eat (), Sport Sport (), Sleeping sleep (), getting the number getsum (), the former defeating the latter defeat (Moba A,moba b) "defeat rule: the former seizes the latter all, the latter clearing 0"Among them, eat to make blood volume plus 50, exe
Meet the requirements is the type of timestamp, calculate the time difference, if full of less than one months according to one months calculation. Users May 27 ordered, until June 27 expires, even in May there are 31 days. Package File;import Java.sql.timestamp;public class Timeutil {public static void main (string[] args) {String time1= "2000- 02-29 01:12:12 "; String time2= "2000-03-30 12:12:12"; Timestamp a=timestamp.valueof (time1); Timestamp b=timestamp.valueof (time2); System.out.println
class supports grouping regular expressions and Multiple matching of regular expressions.Java code example:Pattern P = pattern. Compile ("// D + ");Matcher M = P. matcher ("22bb23 ");M. pattern (); // returns P, that is, the pattern object created by which the matcher object is returned.4. matcher. Matches ()/matcher. lookingat ()/matcher. Find ()The matcher class provides three matching operation methods. All three methods return the boolean type. If the match is received, true is returned. If
: /** * time plus minus processing * $strDate: Time string to process * $days: Add and Subtract days **/public function ChangeDate ($strDate, $ Days) { $time = time (); if (Isset ($strDate) !empty ($strDate)) { $time = Strtotime ($strDate); } Return date (' y-m-d h:i:s ', Strtotime ("$days Day", $time)); }Get the current week, month, and tail date sample code: /** * Get current week, month's Day and tail date * * $
Pictureslibrary
Videoslibrary
Musiclibrary
Enterpriseauthentication
Sharedusercertificates
Removablestorage
Appointments
Contacts
Such as: Capabilities > name= "documentslibrary"/> name = "Removablestorage" /> Capabilities >16. Change the namespace of the Virsualelements node and its child nodes to UAPuap:visualelementsDisplayName= "APP9"Square150x150logo= "Assets\logo.png"Square44x44logo= "Assets\smalllogo.png"Description= "APP9"BackgroundColor= "Trans
calculation sample code:
/*** Time addition/subtraction processing ** $ strDate: Time string to be processed * $ days: plus or minus days **/public function ChangeDate ($ strDate, $ days) {$ time = time (); if (isset ($ strDate )! Empty ($ strDate) {$ time = strtotime ($ strDate);} return date ('Y-m-d H: I: s ', strtotime ("$ days day", $ time ));}
Sample Code for obtaining the start and end dates of the current week and month:
/*** Get the start and end dates of the current week and month ***
MyMathLib series (vector and matrix-preparations)
Because the computing workload of vectors and matrices is relatively large, several definition classes are added here for better code writing. These definitions or extension methods will be applied in future code:1. Public Enumeration type
/* File: PublicEnums. cs * objective: to define a public Enumeration type. */using System; using System. collections. generic; using System. linq; using System. text; namespace MyMathLib {////// Elementary tran
: return date ("m Month d day H: I", $ time); case 3: return date ("m/d H: I", $ time ); case 4: return date ("Y, m, d, H: I", $ time); case 5: return date ("Y/m/d H: I ", $ time); case 6: return date ("Y, m, d, H: I: s", $ time); case 7: return date ("Y-m-d H: I: s", $ time); case 8: return date ("Y/m/d H: I: s ", $ time); default: return $ strDate ;}}
Date calculation sample code:
/*** Time addition/subtraction processing ** $ strDate: Time string to be processed * $ days: plus or minus days
1#include 2 3 //4 //Wu Shuling5 //time: 2016, 04,6 //7 //"The grandson counts the" the " matter does not know the number" the question:8 //This is not known for its number, 33 of the remaining two, 55 of the remaining seven, 77 of the remaining two, ask the geometry of the matter? 9 // Ten //According to test instructions we have the following equation groups: One //x=2%3---> x=3*k+2 A //x=3%5 - //x=2%7 - // the - - //Analytic method for solving - intAnalytical (floatM1,floatM2,floatM3,floatA
block ourselves, and then to illustrate:DEF M1 P' Start inchM1 ... ' M2 do # code block p' Start inch Block inchM1 ... ' P' End inch Block inchM1 ... ‘EndP' End inchM1 ... ‘Enddef m2 BlockP' Start inchM2 ... ‘Block. Call P' End inchM2 ... ‘EndM1 # Output Result: # #"Start in M1 ... "#"Start in m2 ... "#"start in block in M1 ... "#"End in block in M1 ... "#"End i
course, there may be more than one hidden path between two nodes. Whether it's a normal road or a hidden road, a certain amount of gold coins can be obtained when the Cong first passes. Cong now from the 1 junction Point, to the MM where the N junction point. Cong Although save MM eager, but he also hope to take more gold coins, so now your goal is: to ensure that the time required to minimize the premise, take the most coins. "input Format" The input file meet.in contains
structure, and one uses the interface structure.
Figure 1: UML class diagram of the Demo code
The following code implements each user-defined data type, and I write the implementation very easily.
/* Base. Java */Public class base{Public String M1 (){Return "base. M1 ()";}Public String m2 (string S){Return "base. m2 (" + S + ")";}}/* Itype. Java */Interface itype{String
-defined Type. Each rectangle in an independent implementation (such as type orientation) represents a type. From the implementation method, four types Use the class structure, and one uses the interface structure.
Figure 1: UML class diagram of the Demo code
The following code implements each user-defined data type, and I write the implementation very easily.
/* Base. java */
Public class Base{Public String m1 (){Return Base. m1 ();}
Public String m2
do not need sleep, do it like this)
public static mySleep(long l){ Object o = new Object(); synchronized(o){ try{ o.wait(l); }catch(Exception e){} } }
Don't worry, no one can call o. Policy [all] outside of this method, so o. Wait (l) will wait until the set time to complete the operation.[Use of virtual locks]
Simply put, the virtual lock does not call the Synchronized Method (which is equivalent to synchronized (this) or doe
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.