1027las

1,呵呵

vector<vector<int>> different(A.size());
        int longest=2;
        for(int i=0;i<A.size();i++){
            for(int i2=i+1;i2<A.size();i2++){
                if(i>0){
                    if(different[i][A[i2]-A[i]+10000]>=2){
                        different[i2][A[i2]-A[i]+10000] = different[i][A[i2]-A[i]+10000] + 1;
            //different[i2][A[i2]-A[i]+10000] = different[i][A[i2]-A[i]+10000] + 1;
                        if(longest < different[i2][A[i2]-A[i]+10000]) longest = different[i2][A[i2]-A[i]+10000];     //都是i2
            }
                    else{
                          different[i2][A[i2]-A[i]+10000]=2;   
            } 
        }
                else{
            vector<int> newint(20001);
            newint[A[i2]-A[i]+10000]=2;
            different[i2]=newint;
        }        
                                                                                  
                         }
                             }
                      return longest;
               

2,啥时候再多想想。

posted @ 2020-04-26 09:45  北月真好  阅读(104)  评论(0编辑  收藏  举报