"Thinking": The rhythm of the brush water problem.
"AC Code":
#include <iostream> #include <algorithm> #include <string> #include <cstdio> #include <cstring>using namespace std; #define MAX 1000+2#define max_name_num 20+2struct student{ char Name[max_name_num+2];char num[max_name_num+2];char sex;}; Student student[max];int n = 0;char getsex (char info[]) {int i = 0;for (i = 0; i < n; i++) {if (!strcmp (info, student[i]). Name) return Student[i].sex;else if (!strcmp (info, student[i].num)) return student[i].sex;}} int main () {//freopen ("In.txt", "R", stdin); int i = 0;//inputcin >> n;for (i = 0; i < n; i++) {cin >> Student [I].name >> student[i].num >> student[i].sex;} Findint m = 0;cin >> m;for (i = 0; i < m; i++) {char sex_a, Sex_b;char Info_a[max_name_num], Info_b[max_name_num ];cin >> info_a >> info_b;sex_a = Getsex (info_a); Sex_b = Getsex (Info_b); if (sex_a! = Sex_b) cout << "Y" & lt;< endl;elsecout << "N" << Endl;} return 0;}
Blue Bridge Cup ALGO-94 freshman Prom (structural)