80分 求调,#4答案跟洛谷一样为什么不给过

P1603 斯诺登的密码

wadaxinei @ 2024-10-27 20:56:11

#include<stdio.h>
#include<string.h>
int k;
int main()
{
    char dic[30][20]={"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"};
    char a[10];
    int i,j,d[6]={0};
    int c[6]={0,1,2,3,4,5};
    int di[30]={0,1,4,9,16,25,36,49,64,81,00,21,44,69,96,25,56,89,24,61,0,1,4,1,1,4,9};

    for(i = 0; i < 6; i ++){
        scanf("%s",&a);
        for(j = 0; j < 26; j ++){
            if(strcmp( a , dic[j]) == 0)
            {
                d[ c[k] ] = di[j];
                k ++;
                break;
            } 
        }
    }

    if(k == 0) {
        printf("0");
        return 0;
    }else{

    for(i = 0 ; i < 6 ; i ++){
        for(j = 0 ; j < 5 ; j ++){
            if(d[j]>d[j + 1]){
                k = d[j + 1];
                d[j + 1] = d[j];
                d[j] = k;
            }
        }
    }
    int n = 0;

    for(i = 0 ; i < 6 ; i ++){
        if(d[i] == 0) continue;
        else{
            if(d[i - 1] == 0 && n == 0 &&d[i] > 0 &&d[i] < 10){
                    printf("%d",d[i]);
                    n++;
            }
            else{

            if(d[i] > 0 && d[i] < 10) 
                  printf("0%d",d[i]);
            else printf("%d",d[i]);
            }
        }
    }
}

    return 0;
}

by wadaxinei @ 2024-10-27 21:02:43

第四个one two three four five six . 答案10409162536 我在编译器上的输出结果也是这个,为啥洛谷不过


by qwe962 @ 2024-11-18 00:18:55

找到问题了吗


by ddm23333 @ 2024-11-28 22:10:53

我的也是


|