amazon acm

Learn about amazon acm, we have the largest and most updated amazon acm information on alibabacloud.com

HDU ACM 1269 Maze Castle--forward strong connected components (Tarjan algorithm practice)

Analysis: To determine whether a graph is a strongly connected component, which is solved using the Tarjan algorithm.#include HDU ACM 1269 Maze Castle--forward strong connected components (Tarjan algorithm practice)

Wuhan University of Science and Technology acm:1009: Chinese Edition C language Programming tutorial (second edition) Exercise 5.12

Problem Descriptionthis day the teacher as a routine to small Hao out a topic: The teacher to small Hao a string, let small Hao will the string in reverse order output. InputThe first line includes a T, which indicates how many sets of test data are:Next T line, each line includes a string (length not exceeding 65535).OutputFor each test data output it's reverse string.Sample Input1oaHoaiX EvoL ISample OutputI Love Xiaohao1#include 2#include string.h>3 intMain ()4 {5 intL,i,n;6 Chara[655

Java solves some of the large number problems in ACM

, you is also intelligent enough to tackle this kind of people. You agreed to write only the (integer) Division and mod (% in C + +) operations for him.InputInput is a sequence of lines. Each line would contain an input number. One or more spaces. A sign (division or MoD). Again spaces. and another input number. Both the input numbers is non-negative integer. The first one may be arbitrarily long. The second number n would be is in the range (0 OutputA line for each input, each containing an int

HDU ACM 1142 A Walk Through the FOREST->SPFA algorithm + memory Deep Search

Analysis: Find Jimmy from the office through the Forest back home (that is, from point 1 to 2) The shortest path there are how many, in which to meet if you want to go to a to B this road, then there is a to the end of the distance from a to the end of the distance is greater than B.Solution: SPFA algorithm + memory Deep Search1. SPFA find the shortest path from the end point 2 to all other points2, the memory of Dfs from 1 start to other points deep search, the final result is dp[1].#include HD

Wuhan University of Science and Technology acm:1002:0 starting point algorithm 28--judging whether leap year

Problem DescriptionEnter the year to determine if the leap yearsInputEnter an integer n (multiple sets of data)OutputIf it is a leap year, output Yes, otherwise output no (one row per group of data)Sample Input2000Sample OutputYesMy Code:1#include 2 intMain ()3 { 4 intYear ;5 while(SCANF ("%d", year)! =EOF)6 {7 8 if((year%4==0 year% -!=0) || (year% -==0) ) 9 {Tenprintf"yes\n"); One } A Else - { -printf"no\n"); the } -

Wuhan University of Science and technology acm:1009:0 start-up algorithm 63--bow matrix

=0; ii) A { at if(i%2==0) - { - for(j=0; jj) - { -a[i*col+j]=++K; - } in - } to Else + { - for(j=col-1; j>=0;--j) the { *a[i*col+j]=++K; $ }Panax Notoginseng } - the } + for(i=0; ii) A { the for(j=0; j1;++j) + { -COUT2) " "; $ } $COUT2) Endl; -

Wuhan University of Science and Technology acm:1008: Chinese Edition C language Programming tutorial (second edition) Exercise 6.14

Problem DescriptionEnter an octal string, convert it to an equivalent decimal string, and output it in the PRINGF%s format.InputFirst, a positive integer t is entered, indicating that there is a T set of test data (1Next T line, one string per line, representing an octal integer (this integer is no more than 20 bits).OutputFor each test data, output the corresponding decimal string. One line per string.Sample Input11732Sample Output986HINTNote: The given octal number may be large, with a long lo

Wuhan University of Science and Technology acm:1003:0 starting point algorithm 78--beef cattle

at for(i=0; i2; i++) - { - for(j=i+1; j3; J + +) - { - for(k=j+1; k4; k++) - { in if((A[i]+a[j]+a[k])%Ten==0) - { tob1=1; +sum1=0; - for(i1=0; i14; i1++) the { * if(i1!=i i1!=j i1!=k) $

Wuhan University of Science and Technology Acm:1005:c Language Programming Tutorial (third Edition) after class exercise 6.6

Problem DescriptionTo print out all the "daffodils", the so-called "Narcissus number" refers to a three-digit number, whose numbers are cubic and equal to that of itself. For example: 153 is a narcissus number, because 153=1^3+5^3+3^3. Output:153?????????InputNoOutputThe number of daffodils, the beginning of childhood. One per lineSample InputSample Output1#include 2 3#include 4 5 6 7 intMain ()8 9 {Ten One inti; A - for(i= -;i +; i++) - the if(I==pow (i

Wuhan University of Science and Technology acm:1004:0 starting point algorithm 74--palindromes _easy version

+ for(i=0; i) - $ { $ -scanf"%s",a); - the if(Fun (a) = =0) - Wuyiprintf"no\n"); the - Else Wu -printf"yes\n"); About $ } - - return 0; - A}#include #includestring.h>intMain () {Charstr[ -]; intn,i,j; scanf ("%d",N); while(n>0) {scanf ("%s", str); I=0; J=strlen (str)-1; while(ij) {if(str[i]!=Str[j]) Break; I++; J--; } if(i>j) printf ("yes\n"); Elseprintf ("no\n"); N--; } return 0;}Wuhan University of

Wuhan University of Science and technology acm:1003:0 start-up algorithm 14--three-digit inversion

Problem DescriptionWater problemInputEnter a 3-digit number (the title contains multiple sets of test data)OutputSeparates the 3-digit hundred, 10-bit, and single-digit, inverted output (one row of test data per group)Sample Input250Sample Output052HINTSeparating out the numbers, you can use the remainder and the divisor.Note that in C, 2 integers are multiplied except for the result or integer, such as 8/3 in the C language, and the result is 2.Use symbol% for remainderFor example, the result o

Using USB to simulate ACM serial device under Linux

(which can be supported by OTG), this driver can enable us to implement a USB port on this USB channel; it's like having PL2303 or HM340 hard Supported by USB. Of course, our device is in the presence of USB slave, the driver support situation, this link looks like a normal serial connection. Its source code is in/DRIVERS/USB/GADGET/SERIAL.C, and there is also document Documentation/usb/gadget_serial.txt. You can read it yourself. (In fact, Google's ADB tools and this is the same thing, maybe e

Hangzhou Electric HDU ACM ASCII code sequencing

ASCII-code OrderingTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 103963 Accepted Submission (s): 43442Problem description Input Three characters, the ASCII code of each character is printed in order from small to large to output these three characters.Input data has more than one group, each of which consists of three characters and no spaces between them.Output for each set of input data, one line is printed, and the characters are separate

"ACM" ASCII code ordering

/*! Title: After describing the input three characters (which can be duplicated), the ASCII code of each character is printed in the order of three characters from small to large. Enter the first line to enter a number n, indicating that there are n sets of test data. The next n rows enter multiple sets of data, each with a row of three characters and no spaces between them. Output for each set of input data, output one line, the middle of the character separated by a space. Sample input 2QWEASD

Summary of ACM greedy algorithm

The nature of the greedy algorithm:is the optimal solution of the current state, which does not consider the global.What is the optimal solution for the current state?Cost issues? Https://www.cnblogs.com/xuxiaojin/p/9400892.html (POJ 2393) This involves the cost per week, as long as the cost of the current week is the lowest possible, do not consider the costs behind. Https://www.cnblogs.com/xuxiaojin/p/9401179.html (POJ 3626) The maximum cost of this design to the cow to destroy th

Various input scenarios for the Java Language (ACM Common)

);}Or you can write it like this:System.out.println ("Please enter an integer n");Scanner s=new Scanner (system.in);int N=integer.parseint (S.nextline ());for (int i=0;iString Str=s.nextline ();System.out.println (str);}3. Input stringIf given a date, the date of the output is the day ordinal of the year.System.out.println ("Please enter a year");Scanner s=new Scanner (system.in);int dd[]={0,31,28,31,30,31,30,31,31,30,31,30,31};while (S.hasnext ()) {int days=0;String Str=s.nextline ();String[] D

HDU ACM 5249 kpi-> tree-shaped array + two-point

Analysis: Note that the queue holds the subscript in the sorted array. The tree array is also processed according to the subscript.#include HDU ACM 5249 kpi-> tree-shaped array + two-point

ACM Learning process-fzu 2144 Shooting Game (Computational geometry && greed && sorting)

the subsequent point is guaranteed to be greater than the to time of the current time.PS: If the direct input according to double type will be reported time-out ....Code:#include #include#include#include#include#include#includeSet>#include#include#includestring>using namespaceStd;inlineDoublePow2 (Doublex) { returnx*x;}structnode{Double from, to;} t[100005];BOOLCMP (Node A, Node B) {if(A.to! =b.to)returnA.to b.to; Else returnA. from from;}intN, R, CNT, ans;intpx, py, PZ;voidWork () {

acm-Bubble Sort

Bubble-Sort multiple sets of input data and remove the same data#include #includeusing namespacestd;voidRank (intAdd[],intN)//bubble Sort {intI,j,num; for(i=0; i1; i++){ for(j=0; j2; j + +){ if(add[j]>add[j+1]) {num=Add[j]; ADD[J]= add[j+1]; Add[j+1] =num; } } }}intMain () {intn =0; intnum[1001]={0}; while(SCANF ("%d", n)! =EOF) { intm =N; while(n>0) {n--; scanf ("%d",Num[n]); } Rank (Num,m); for(intI=0; i){ if(num[i]!=num[i-1]) coutEndl; }} retur

Common Java Code for ACM

1 ImportJava.util.*;2 ImportJava.io.*;3 4 Public classMain {5 Public Static voidMain (string[] args)throwsioexception{6 //Calculate program Run time7 //Arrays8 LongSt =System.currenttimemillis ();9 if("abc" = = "abc") System.out.println ("Yes1");TenString str1 =NewString ("ABC"); OneString str2 =NewString ("ABC"); A if(str1 = = str2) System.out.println ("Yes2"); - if(Str1.equals (STR2)) System.out.println ("Yes3"); - the // -

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.