zoukankan      html  css  js  c++  java
  • pang

    #include <iostream>
    #include <fstream>
    #include <string>
    #include <algorithm>
    #include "math.h"
    #include <stack>
    
    #define MAXN 300
    
    using namespace std;
    
    int input[MAXN*2];
    stack<int> m_stack;
    
    int main(){
        int N(0),K(0);
        cin>>N>>K;
        for(int i=0;i<N+K;i++){
            cin>>input[i];
        }
        int count(0);
        int iter(0);
        int temp = input[iter];
        count++;
        while(count<N){
            if(temp==input[count]){
                input[iter]++;
                input[count]=-1;
                if(iter>0){
                    iter--;}
                while(iter>0&&input[iter]==-1)
                    iter--;
                
                temp = input[iter];
                count--;
                while(input[count]==-1)
                    count--;
                if(count==iter){
                    count++;
                    while(input[count]==-1){
                    count++;
                    }
                }
                N++;
            }
            else{
            iter++;
            count++;
            while(input[iter]==-1)
                iter++;
            while(input[count]==-1)
                count++;
            temp = input[iter];
        
            }
    
        }
        int max=0;
        for(int i=0;i<N;i++){
        if(input[i]>max)
            max = input[i];
        
        }
        cout<<"max is "<<max<<endl;
        system("pause");
    
    
    return 0;
    }
  • 相关阅读:
    第二次结对编程总结
    结对编程作业博客
    现状、经验和计划
    个人总结
    6月中旬开发心得
    读《软件开发沉思录》
    团队进度汇报
    个人课程总结
    Beta阶段总结
    冲刺第十天 1.11 FRI
  • 原文地址:https://www.cnblogs.com/lauraxia/p/3746728.html
Copyright © 2011-2022 走看看