zoukankan      html  css  js  c++  java
  • buy or not buy

        

    #include<stdio.h>
    #include<stdbool.h>
    #include<stdlib.h>
    #include<string.h>
    int main(int argc,char const *argv[]){
      int h[62]={0};
      int ret;
      char str1[1000],str2[1000];
      scanf("%s%s",str1,str2);
        //printf("%s
    ",str1);
        //printf("%s
    ",str2);
    
        for(int i=0;str1[i];i++){
           if(str1[i]>='0'&&str1[i]<='9'){
                ret = str1[i]-'0';
           }else if(str1[i]>='a'&&str1[i]<='z'){
                ret = str1[i]-'a'+10;
           }else{
                ret = str1[i]-'A'+36;
           }
              h[ret]++;
        }
        /*
          for(int i=0;i<62;i++){
             printf("h[%d]=%d
    ",i,h[i]);
          }
    */
        int  cnt = 0;
        int  num = 0;
        bool flag = true;
        for(int i=0;str2[i];i++){
            if(str2[i]>='0'&&str2[i]<='9'){
                ret = str2[i]-'0';
           }else if(str2[i]>='a'&&str2[i]<='z'){
                ret = str2[i]-'a'+10;
           }else{
                ret = str2[i]-'A'+36;
           }
             if(h[ret]){
                cnt++;
                h[ret]--;
             }else{
                num++;
             }
        }
        if(cnt==strlen(str2)) printf("Yes %d
    ",strlen(str1)-strlen(str2));
         else printf("No %d
    ",num);
        return 0;
     }
     
  • 相关阅读:
    Service、chkconfig命令
    mongoDB 入门
    HTTP 缓存
    MIME类型记录
    CSS3 动画 思维导图
    部署Seafile服务
    AngularJS 学习笔记
    Bootstrap3 学习笔记
    CSS 弹性盒
    传送门(portal)
  • 原文地址:https://www.cnblogs.com/sunnybowen/p/9393329.html
Copyright © 2011-2022 走看看