Hdu-1800 (MAP)

Source: Internet
Author: User

What kindCodeThe difference is whether you think about it in another way.

Isn't it possible to solve such a difficult problem with simple map?

MAP is good. It is used for function ing. In fact, you can map arrays, but it is just one thing:

The array is linear. You can store O (1), but you can find O (n.

However, this is not the case with map, which is based on the data you saved. Sparse data can be used quickly.

If it is very dense, it is similar to array.

In addition, map can define the key as many types, but the array can only be a positive integer.

I have to review it...

 # include 
  
    # include 
   
    #include 
    
     #include 
      # include 
      
        using namespace STD; int N; int main () {int input; Map 
       
         m; map 
        
         : iterator it; while (scanf ("% d", & N )! = EOF) {for (INT I = 0; I 
         
           second; If (temp> MAX) {max = temp ;}} printf ("% d \ n ", max); M. clear () ;}// system ("pause"); Return 0 ;}
         
        
       
      
    
   
  

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.