• P1603 斯诺登的密码


    P1603 斯诺登的密码

    题解

    注意字符比较相同用 单引号 ‘ ’

    字符串比较相同用 双引号 “ ”

    注意本题非正规和正规对的都能被人翻译成数字

    代码

    #include<iostream>
    #include<cstdio>
    #include<string>
    #include<cstring>
    #include<algorithm>
    #include<cmath>
    #include<cstdlib>
    #include<queue>
    
    using namespace std;
    
    inline int read()
    {
        int ans=0;
        char last=' ',ch=getchar();
        while(ch<'0'||ch>'9') last=ch,ch=getchar();
        while(ch>='0'&&ch<='9') ans=ans*10+ch-'0',ch=getchar();
        if(last=='-') ans=-ans;
        return ans;
    }
    inline int readch()
    {
        char c;
        do
        {
            c=getchar();
        }while(c==' '||c=='
    '||c==''||c=='	');
    }
    
    int a[7];
    string s;
    int change(string x)
    {
        if(x=="one"||x=="One"||x=="a"||x=="A"||x=="first"||x=="First") return 1;
        if(x=="two"||x=="Two"||x=="both"||x=="Both"||x=="second"||x=="Second") return 2;
        if(x=="three"||x=="Three"||x=="another"||x=="Another"||x=="third"||x=="Third") return 3;
        if(x=="four"||x=="Four") return 4;
        if(x=="five"||x=="Five") return 5;
        if(x=="six"||x=="Six") return 6;
        if(x=="seven"||x=="Seven") return 7;
        if(x=="eight"||x=="Eight") return 8;
        if(x=="nine"||x=="Nine") return 9;
        if(x=="ten"||x=="Ten") return 10;
        if(x=="eleven"||x=="Eleven") return 11;
        if(x=="twelve"||x=="Twelve") return 12;
        if(x=="thirteen"||x=="Thirteen") return 13;
        if(x=="fourteen"||x=="Fourteen") return 14;
        if(x=="fifteen"||x=="Fifteen") return 15;
        if(x=="sixteen"||x=="Sixteen") return 16;
        if(x=="seventeen"||x=="Seventeen") return 17;
        if(x=="eighteen"||x=="Eighteen") return 18;
        if(x=="nineteen"||x=="Nineteen") return 19;
        if(x=="twenty"||x=="Twenty") return 20;
        return -1;
    }
    
    int main()
    {
        for(int i=1;i<=6;i++)
        {
            cin>>s;
            int kk=change(s);
            if(kk*kk%100<=0||kk<=0){ a[i]=100;continue; } 
            else a[i]=kk*kk%100;
        }
        sort(a+1,a+7);
        bool flag=0;
        for(int i=1;i<=6;i++)
        {
            if(a[i]>=100)break;
            else
            {
                if(flag==0)
                { printf("%d",a[i]); flag=1;}
                else
                {
                    if(a[i]<10) printf("0");
                    printf("%d",a[i]);
                }
            }
        }
        if(!flag) printf("0");
        return 0;
    }
    
     
  • 相关阅读:
    VS2008正式版序列号
    清空SQL Server数据库中所有的用户表
    [原创]JavaScript调用Button的服务器端事件
    动态加载枚举 到 DropdownList
    [转载]静态构造函数
    SQL 事务 [两种]
    Jpg文件格式[参考]
    Delegate Event
    javascript 操作cookie类
    [共享]一个文件上传的控件,绝对是精品源码
  • 原文地址:https://www.cnblogs.com/xiaoyezi-wink/p/11256206.html
Copyright © 2020-2023  润新知