Click on the link full solution summary PAT B -AC
Topic:
Here is circulating on Weibo photo: "Dear students, given that we sometimes need to use wifi, afraid to delay the pro learning, now wifi password is set to answer the following math problem: A-1; B-2; C-3; D-4;. ask someone to answer their own, a change every two days - thank you !! "- teachers to promote student learning is the fight ...... this question requires you to write the program title translated into a series of answers wifi password is given in accordance with the correspondence between the papers. Here simply assume that each multiple-choice questions have four options and only one correct answer.
Input formats:
given input of the first line of a positive integer N (≤ 100), followed by N lines, each in accordance with the number - gives four options for a question answer format, T is the correct option, F indicates an error options. Separated by spaces option.
Output formats:
Output wifi passwords in a row.
Sample input:
8
A-T B-F C-F D-F
C-T B-F A-F D-F
A-F D-F C-F B-T
B-T A-F C-F D-F
B-F D-T A-F C-F
A-T C-F B-F D-F
D-T B-F C-F A-F
C-T A-F B-F D-F
Sample output:
13224143
My code:
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstring>
#include<sstream>
using namespace std;
//有的时候题目是一起做的,所以会有不需要的头文件
int main()
{
int N;
cin>>N;
getchar();
for(int i=0;i<N;i++)
{
string temp;
getline(cin,temp);
for(int j=2;j<temp.length();j++)
{
if(temp[j]=='T')cout<<temp[j-2]-'A'+1;
}
}
return 0;
}