蒟蒻求助,第四个测试点WA

P1603 斯诺登的密码

云岁月书 @ 2019-10-05 20:50:52

又是string类型,不知道为什么调试不了


by 云岁月书 @ 2019-10-05 20:51:04

include <iostream>

include <cstring>

include <string>

include <algorithm>

using namespace std; string num[22]={"a", "one","two","three","four","five","six","seven", "eight","nine","ten","eleven","twelve","thirteen", "fourteen","fifteen","sixteen", "seventeen","eighteen","nineteen","twenty"}, a[22]={"a","a","second","third"}, b[22]={"a","another","both"}, c[22]={"a","first"}, cha; bool flag; int ans[7],k=0,out=0; int main(){ cin.sync_with_stdio(false); for(int i=0;i<6;i++){ cin>>cha; for(int j=1;j<22;j++){ if(num[j]==cha||cha==a[j]||cha==b[j]||cha==c[j]) ans[k++]=(jj)%100; } } sort(ans,ans+k); for(int i=0;i<k;i++){ out+=ans[i]; out=100; } cout<<out/100; return 0; }


by SfumatoCannon_ @ 2019-10-05 20:54:28

希丰展?使MD


by 云岁月书 @ 2019-10-05 20:57:57

# include <iostream>
# include <cstring>
# include <string>
# include <algorithm>
using namespace std;
string num[22]={"a",
"one","two","three","four",
"five","six","seven",
"eight","nine","ten","eleven",
"twelve","thirteen",
"fourteen","fifteen","sixteen",
"seventeen","eighteen",
"nineteen","twenty"},
a[22]={"a","a","second","third"},
b[22]={"a","another","both"},
c[22]={"a","first"},
cha;
bool flag;
int ans[7],k=0,out=0;
int main(){
cin.sync_with_stdio(false);
for(int i=0;i<6;i++){
cin>>cha;
for(int j=1;j<22;j++){
 if(num[j]==cha||cha==a[j]
 ||cha==b[j]||cha==c[j])
    ans[k++]=(j*j)%100;
    }
}
    sort(ans,ans+k);
    for(int i=0;i<k;i++){
        out+=ans[i];
        out*=100;
    }
    cout<<out/100;
        return 0;
} 

by 云岁月书 @ 2019-10-05 20:59:05

# include <iostream>
# include <cstring>
# include <string>
# include <algorithm>
using namespace std;
string num[22]={"a",
"one","two","three","four","five","six","seven",
"eight","nine","ten","eleven","twelve","thirteen",
"fourteen","fifteen","sixteen",
"seventeen","eighteen","nineteen","twenty"},
a[22]={"a","a","second","third"},
b[22]={"a","another","both"},
c[22]={"a","first"},
cha;
bool flag;
int ans[7],k=0,out=0;
int main(){
    cin.sync_with_stdio(false);
    for(int i=0;i<6;i++){
        cin>>cha;
        for(int j=1;j<22;j++){
            if(num[j]==cha||cha==a[j]||cha==b[j]||cha==c[j])
                ans[k++]=(j*j)%100;
        }
    }
    sort(ans,ans+k);
    for(int i=0;i<k;i++){
        out+=ans[i];
        out*=100;
    }
    cout<<out/100;
        return 0;
} 

by 云岁月书 @ 2019-10-05 21:02:45

好吧,不需要了; 第四个点爆了int范围


|