40分疑惑

P1603 斯诺登的密码

阿布鲁派 @ 2020-11-23 21:36:05

#include<bits/stdc++.h>
using namespace std;
char s[50][50]={"waluyiji","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 n[50]={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 s1[55555];
int f,sum,ans[10]={0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff};
int main(){
    for(int i=1;i<=6;i++){
        scanf("%s",s1);
        s1[0]=tolower(s1[0]);
        for(int j=1;j<=26;j++){
            if(!strcmp(s1,s[j])){
                ans[i]=n[j];
                sum++;
                break;
            }
        }
    }
    sort(ans+1,ans+1+sum);
    for(int i=1;i<=sum;i++){
        if(ans[i]!=0&&!f&&ans[i]!=0x7fffffff){
            cout<<ans[i];
            f=1;
        }
        else if(f&&ans[i]!=0x7fffffff)printf("%.2d",ans[i]);
    }
    if(!f)cout<<0;
    return 0;
}

by metaphysis @ 2020-11-23 22:05:14

@吾皇嘿嘿嘿

Hack:

zero zero zero zero zero one

正确输出:1,您的输出:0。


by Otue @ 2021-01-05 18:51:46

Obama is a two five zero.

奥巴马是250(二百五)


|