1. 程式人生 > >1076 Wifi密碼

1076 Wifi密碼

space problem default 題目 bit ret lin urn code

題目鏈接:https://pintia.cn/problem-sets/994805260223102976/problems/994805262622244864

題解:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 int main() {
 5     int n, i;
 6     cin >> n;
 7     vector<int>ans;
 8     getchar();
 9     string *str = new string[n];
10     for (int i = 0; i < n; i++)
11 getline(cin, str[i]); 12 for (int i = 0; i < n; i++) { 13 int j = 0; 14 for (; j < str[i].size(); j++) { 15 if (str[i][j] == T) break; 16 } 17 switch (str[i][j - 2]) { 18 case A: 19 ans.push_back(1); 20 break
; 21 case B: 22 ans.push_back(2); 23 break; 24 case C: 25 ans.push_back(3); 26 break; 27 default: 28 ans.push_back(4); 29 break; 30 } 31 } 32 vector<int>::iterator it = ans.begin();
33 for (; it != ans.end(); it++) 34 cout << *it; 35 return 0; 36 }

1076 Wifi密碼