为什么我手撸数据点是对的,测评机全WA了。大神求解。。

P1603 斯诺登的密码

insprition @ 2016-06-20 09:20:06

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    int c=1,d=0,i;
    string a[8],b[8];
    for(i=1;i<=6;i++)
          cin>>a[i];
    for(i=1;i<=6;i++)
      if(/*a[i]=="zero"||*/a[i]=="ten"/*||a[i]=="tenth"||a[i]=="twenty"||a[i]=="twentieth"*/){b[c]="00";c++;}
      else if(a[i]=="one"||a[i]=="a"||a[i]=="first"||a[i]=="another"/*a[i]=="an"||*/){b[c]="01";c++;}
      else if(a[i]=="two"||a[i]=="both"||a[i]=="second"){b[c]="04";c++;}
      else if(a[i]=="three"/*||a[i]=="third"*/){b[c]="09";c++;}
      else if(a[i]=="four"/*||a[i]=="fourth"*/){b[c]="16";c++;}
      else if(a[i]=="eleven"/*||a[i]=="eleventh"*/){b[c]="21";c++;}
      else if(a[i]=="eighteen"/*||a[i]=="eighteenth"*/){b[c]="24";c++;}
      else if(a[i]=="five"||/*a[i]=="fifth"||*/a[i]=="fifteen"/*||a[i]=="fifteenth"*/){b[c]="25";c++;}
      else if(a[i]=="six"/*||a[i]=="sixth"*/){b[c]="36";c++;}
      else if(a[i]=="twelve"/*||a[i]=="twelfth"*/){b[c]="44";c++;}
      else if(a[i]=="seven"/*||a[i]=="seventh"*/){b[c]="49";c++;}
      else if(a[i]=="sixteen"/*||a[i]=="sixteenth"*/){b[c]="56";c++;}
      else if(a[i]=="nineteen"/*||a[i]=="nineteenth"*/){b[c]="61";c++;}
      else if(a[i]=="eight"/*||a[i]=="eighth"*/){b[c]="64";c++;}
      else if(a[i]=="thirteen"/*||a[i]=="thirteenth"*/){b[c]="69";c++;}
      else if(a[i]=="nine"/*||a[i]=="ninth"*/){b[c]="81";c++;}
      else if(a[i]=="seventeen"/*||a[i]=="seventeenth"*/){b[c]="89";c++;}
      else if(a[i]=="fourteen"/*||a[i]=="fourteenth"*/){b[c]="96";c++;}
    c--;
    sort(b+1,b+c+1);
    for(i=2;i<=c;i++)
      b[1]+=b[i];
    while(b[1][d]=='0')d++;
    for(i=d;i<=2*c;i++)
      cout<<b[1][i];
    return 0;
}//one two three four five six .nineteen nineteen nineteen nineteen nineteen nineteen .

by 渣渣炸了 @ 2016-06-20 09:25:19

正常


by zht467 @ 2016-06-20 09:48:32

你确定你手**的测试点跟洛谷的是一样的?


by crowworks695 @ 2016-06-20 16:02:43

@insprition 洛谷是linux系统评测,换行符与windows不同,尽量用scanf %s 或者cin>>a,直接cin到string类里,避免逐字符读入


by ddd @ 2016-06-20 23:17:57

@crowworks695 此言得之 想当初NOIP2015 D2T2就是这么爆零的


by crowworks695 @ 2016-06-21 12:40:37

@Drench 那一定很冤


by ddd @ 2016-06-21 12:52:49

@crowworks695 还好最后混了个二等奖 要是没奖就冤死了


by crowworks695 @ 2016-06-21 15:12:08

@Drench 666我今年十一月才比


by yzz2016 @ 2016-08-17 09:51:49

难怪下载测试数据的时候会没有换行


|