初赛自测

posted on 2021-09-20 00:05:18 | under 灌水 | source

如果你记了答案可以测一下(误)

S

#include <cctype>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int pdnum[]={4,3,3};
string stdans="abaccccbdaacccbtfftdctffbcbftfbdddadcadaddc";
string yourans;
double w[1010];
double init(){
    for(int i=1;i<=15;i++) w[i]=2;
    for(int i=16;i<=28;i+=6){
        for(int j=i;j<i+pdnum[(i-16)/6];j++) w[j]=1.5;
        for(int j=i+pdnum[(i-16)/6];j<i+6;j++) w[j]=3;
    }
    for(int i=34;i<=43;i++) w[i]=3;
    w[19]=2,w[21]=2.5,w[33]=4;
    return 0;
}
double tot=init();
int main(){
    string tmp;
    while(cin>>tmp) yourans+=tmp;
    cout<<stdans<<endl<<yourans<<endl;
    for(size_t i=1;i<=43;i++){
        if(toupper(stdans[i-1])==toupper(yourans[i-1])) tot+=w[i];
    }
    cout<<tot<<endl;
    return 0;
}

J

#include <cctype>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int pdnum[]={5,3,3};
string stdans="dbacddcabbbacbbffftfbfttbbctffaccdccdbbdcbd";
string yourans;
double w[1010];
double init(){
    for(int i=1;i<=15;i++) w[i]=2;
    for(int i=16;i<=28;i+=6){
        for(int j=i;j<i+pdnum[(i-16)/6];j++) w[j]=1.5;
        for(int j=i+pdnum[(i-16)/6];j<i+6;j++) w[j]=3;
    }
    for(int i=34;i<=43;i++) w[i]=3;
    w[27]=3.5,w[29]=w[30]=2,w[33]=4;
    return 0;
}
double tot=init();
int main(){
    string tmp;
    while(cin>>tmp) yourans+=tmp;
    cout<<stdans<<endl<<yourans<<endl;
    for(size_t i=1;i<=43;i++){
        if(toupper(stdans[i-1])==toupper(yourans[i-1])) tot+=w[i];
    }
    cout<<tot<<endl;
    return 0;
}
posted @ 2022-11-06 20:06  caijianhong  阅读(19)  评论(0编辑  收藏  举报