zoukankan      html  css  js  c++  java
  • 寻找最大的数

    #include<iostream>
    #include<string.h>
    using namespace std;
    char c[100],ans[100];
    int main()
    {
        int len;
        cin>>len;
        while(len--)
        {
            cin>>c;
            int m;
            cin>>m;

            int len=strlen(c);
            int beg=0;
            //重复确定最大,龚 len-m次
            for(int i=0;i<len-m;i++)
            {
                int max=-1;
               
            //

                for(int j=beg;j<=m+i;j++)
                {
                     if((c[j]-'0')>max)
                     {
                         max=c[j]-'0';
                         beg=j+1;
                        // cout<<beg<<endl;
                    
                     }
               
               
                }   
                cout<<max;
           
            }
            cout<<endl;
     
           

       
       
       
       
        }
        system("pause");

    return 0;
    }

  • 相关阅读:
    类型转换
    struts2默认拦截器
    struts2自定义拦截器
    struts2之I18N
    代理模式
    抽象类 abstract class 接口
    java基础题
    final
    内部类
    tomcat 端口占用问题解决
  • 原文地址:https://www.cnblogs.com/hansongjiang/p/3782660.html
Copyright © 2011-2022 走看看