求助大佬!!!

P1603 斯诺登的密码

BCZSX @ 2019-02-20 18:41:06

求助大佬,样例未过!!!

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
char s[40][40]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","a","both","another","first","second","third"};
int num[40]={0,1,4,9,16,25,36,49,64,81,0,21,44,69,96,25,56,89,24,61,0,1,4,1,1,4,9};
char str[110];
ll n,cnt;
int k[10];
bool check;
int main()
{
    for(int i=1;i<=6;++i)
    {
        scanf("%s",str);
        for(int j=1;j<=26;++j)
        {
            if(!strcmp(str,s[j]));
            {
                k[++cnt]=num[j];
                break;
            }
        }
    }
    sort(k+1,k+1+cnt);
    for(int i=1;i<=cnt;++i)
    {
        if(check) printf("%.2d",k[i]);
        else if(k[i]) printf("%d",k[i]),check=true;
    }
    if(!check) printf("0");
    return 0;
}

by 周子衡 @ 2019-02-20 18:59:27

@BCZSX 强啊


by 周子衡 @ 2019-02-20 18:59:51

这一道水题不应该早就做了吗我也没做


by BCZSX @ 2019-02-20 19:02:17

学姐强呀@周子衡


by 周子衡 @ 2019-02-20 19:22:14

@BCZSX 你叫@HarryPotterJames 学姐就行了,不要这么叫我


by 周子衡 @ 2019-02-20 19:22:40

好吧@HarryJamesPotter


by Kuriyama_Mirai @ 2019-02-20 19:23:51

@周子衡 巨呀!把我用户名玩坏了


|