ZigZagKmp @ 2017-10-03 20:44:02
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
by ZigZagKmp @ 2017-10-03 20:46:02
附上代码
- #include<bits/stdc++.h>
- using namespace std;
- string dic[30]={0,"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 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};
- int a[10],top,flag;
- int main()
- {
- int i,j;
- string s;
- for(i=1;i<=6;i++)
- {
- scanf("%s",&s);
- for(j=1;j<=26;j++)
- {
- if(s==dic[j])
- {
- a[++top]=di[j];
- break;
- }
- }
- }
- sort(a+1,a+top+1);
- for(i=1;i<=top;i++)
- {
- if(a[i])
- printf("%.2d",a[i]);
- }
- return 0;
- }