Blue Bridge Cup ALGO-94 freshman Prom (structural)

Source: Internet
Author: User
Tags strcmp

"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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.