WA,WA,还是WA

P1603 斯诺登的密码

liao @ 2018-09-08 18:00:08


(╬ ̄皿 ̄)=○
------------
60分代码
```cpp
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int number[21],s;
char str[30];
int tonum(char ch[]) {
    if(strcmp(str,"one")==0)return 1;
    if(strcmp(str,"two")==0)return 2;
    if(strcmp(str,"three")==0)return 3;
    if(strcmp(str,"four")==0)return 4;
    if(strcmp(str,"five")==0)return 5;
    if(strcmp(str,"six")==0)return 6;
    if(strcmp(str,"seven")==0)return 7;
    if(strcmp(str,"eight")==0)return 8;
    if(strcmp(str,"nine")==0)return 9;
    if(strcmp(str,"ten")==0)return 10;
    if(strcmp(str,"eleven")==0)return 11;
    if(strcmp(str,"twelve")==0)return 12;
    if(strcmp(str,"thirteen")==0)return 13;
    if(strcmp(str,"fourteen")==0)return 14;
    if(strcmp(str,"fifteen")==0)return 15;
    if(strcmp(str,"sixteen")==0)return 16;
    if(strcmp(str,"seventeen")==0)return 17;
    if(strcmp(str,"eighteen")==0)return 18;
    if(strcmp(str,"nineteen")==0)return 19;
    if(strcmp(str,"twenty")==0)return 20;
    return -123;
}
int main() {
    for(int i=1; i<=6; i++) {
        cin>>str;
        if(tonum(str)!=-123)
            number[++s]=(tonum(str)*tonum(str))%100;
    }
    sort(number+1,number+1+s);
    bool flag=false;
    for(int i=1; i<=s; i++)
        if(!flag) {
            if(number[i]) {
                cout<<number[i];
                flag=1;
            }
        } else
            printf("%.2d",number[i]);
    if(!flag)putchar('0');
    return 0;
}
```
蛋疼

by WA鸭鸭 @ 2018-09-09 18:28:08

@Z_ACE 您tql


上一页 |