生活随笔
收集整理的這篇文章主要介紹了
【PAT乙级】1073 多选题常见计分法 (20 分)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
題目地址
#include<cstdio>
#include<iostream>
using namespace std
;
int n
,m
;
struct node
{int score
; int sum
;string ans
;
}Node
[10005];
struct student
{int sum
;int s
[7];
}Student
[1005];
double score
[10005];
int main(void)
{cin
>>n
>>m
;for(int i
=0;i
<m
;i
++){cin
>>Node
[i
].score
>>Node
[i
].sum
;int t
; cin
>>t
;Node
[i
].ans
="";for(int j
=0;j
<t
;j
++) {string s
; cin
>>s
;Node
[i
].ans
+=s
;}}string s
; getline(cin
,s
);for(int i
=0;i
<n
;i
++){getline(cin
,s
);int index
=0;for(int k
=0;k
<m
;k
++){string temp
;while(s
[index
++]!=')'){if(s
[index
]>='a'&&s
[index
]<='z') temp
+=s
[index
];}bool flag
=false;int cnt
=0;for(int j
=0;j
<6;j
++){if(temp
.find('a'+j
)==-1&&Node
[k
].ans
.find('a'+j
)==-1) continue;if(temp
.find('a'+j
)!=-1&&Node
[k
].ans
.find('a'+j
)!=-1) cnt
++;if(temp
.find('a'+j
)==-1&&Node
[k
].ans
.find('a'+j
)!=-1) Student
[k
].s
[j
]++;if(temp
.find('a'+j
)!=-1&&Node
[k
].ans
.find('a'+j
)==-1) Student
[k
].s
[j
]++,flag
=true;}if(!flag
&&cnt
==Node
[k
].ans
.size()) score
[i
]+=Node
[k
].score
;if(!flag
&&cnt
!=Node
[k
].ans
.size()) score
[i
]+=Node
[k
].score
/2.0;}}for(int i
=0;i
<n
;i
++) printf("%.1lf\n",score
[i
]);int index
=0;for(int i
=0;i
<m
;i
++){for(int j
=0;j
<6;j
++) index
=max(index
,Student
[i
].s
[j
]);}if(index
==0) cout
<<"Too simple"<<endl
;else{for(int i
=0;i
<m
;i
++){for(int j
=0;j
<6;j
++) if(Student
[i
].s
[j
]==index
){printf("%d %d-%c\n",index
,i
+1,'a'+j
);}}}return 0;
}
#include<cstdio>
#include<iostream>
#include<map>
#include<string>
using namespace std
;
string s
[105];
int score
[105];
double sum
[1005];
int cnt
[105][8];
int n
,m
;
int main(void)
{cin
>>n
>>m
;for(int i
=0;i
<m
;i
++){cin
>>score
[i
];int t
; cin
>>t
>>t
;for(int j
=0;j
<t
;j
++){string x
; cin
>>x
;s
[i
]+=x
;}} string temp
; getline(cin
,temp
);for(int i
=0;i
<n
;i
++){getline(cin
,temp
);int index
=0;string a
;for(int j
=0;j
<temp
.size();j
++){if(temp
[j
]>='a'&&temp
[j
]<='z') a
+=temp
[j
];if(temp
[j
]==')'){int flag
=0;for(int z
=0;z
<5;z
++){if(s
[index
].find('a'+z
)==-1&&a
.find('a'+z
)==-1) continue;if(s
[index
].find('a'+z
)!=-1&&a
.find('a'+z
)==-1) cnt
[index
][z
]++;if(s
[index
].find('a'+z
)!=-1&&a
.find('a'+z
)!=-1) flag
++;if(s
[index
].find('a'+z
)==-1&&a
.find('a'+z
)!=-1) cnt
[index
][z
]++,flag
=-99;} if(flag
>0&&flag
<s
[index
].size()) sum
[i
]+=score
[index
]/2.0;if(flag
==s
[index
].size()) sum
[i
]+=score
[index
];index
++;a
.clear();}}}for(int i
=0;i
<n
;i
++) printf("%.1lf\n",sum
[i
]);int ans
=0;for(int i
=0;i
<m
;i
++)for(int j
=0;j
<5;j
++) if(cnt
[i
][j
]>ans
) ans
=cnt
[i
][j
];if(!ans
) cout
<<"Too simple"<<endl
;else {for(int i
=0;i
<m
;i
++)for(int j
=0;j
<5;j
++) if(cnt
[i
][j
]==ans
) printf("%d %d-%c\n",ans
,i
+1,'a'+j
);}return 0;
}
總結(jié)
以上是生活随笔為你收集整理的【PAT乙级】1073 多选题常见计分法 (20 分)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。