zoukankan      html  css  js  c++  java
  • hdoj3183【思维】

    思路:
    处理方案非常霸气啊,无奈想不到。
    说是n位去m个,那么默认就是取了n-m个数字,ok,然后m

    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    #include <algorithm>
    #include <math.h>
    #include <queue>
    #include <stack>
    using namespace std;
    #define INF 0x3f3f3f
    #define pi acos(-1.0)
    #define MAX 1010
    int n,m;
    char s[MAX],c[MAX];
    int main()
    {
        int i,j,t,k;
        while(~scanf("%s%d",s,&m))
        {
            memset(c,0,sizeof(c));
    
            k=1;
            n=strlen(s);
            int x=0;
            int pos=0;
            for(i=0;i<n;i++)
            {
                int maxn=INF;
                for(j=i;j<m+k;j++)
                {
                    if(maxn>s[j]-'0')
                    {
                        maxn=s[j]-'0';
                        pos=j;
                    }
                }
                i=pos;
                k++;
                c[x++]=maxn+'0';
            }
    //        printf("%d
    ",k);
            for(i=0;i<n-m;i++)
                if(c[i]!='0')
                    break;
            if(n-m==i)
                printf("0");
            for(;i<n-m;i++)
                printf("%c",c[i]);
            printf("
    ");
        }
        return 0;
    }
  • 相关阅读:
    Redis内存回收策略
    7、IMS
    6、端局、汇接局、关口局、长途局
    5、IMS网元
    4、IMS
    3、NAT
    2、SIP
    1、B2BUA
    九、数据库——sql server 2008导入excel
    六十三、android pad
  • 原文地址:https://www.cnblogs.com/keyboarder-zsq/p/5934803.html
Copyright © 2011-2022 走看看