查詢學生資訊

2021-09-12 09:57:13 字數 1049 閱讀 8299

輸入n個學生的資訊,然後進行查詢。

輸入的第一行為n,即學生的個數(n<=1000)

接下來的n行包括n個學生的資訊,資訊格式如下:

01 李江 男 21

02 劉唐 男 23

03 張軍 男 19

04 王娜 女 19

然後輸入乙個m(m<=10000),接下來會有m行,代表m次查詢,每行輸入乙個學號,格式如下:

0203

0104

輸出m行,每行包括乙個對應於查詢的學生的資訊。

如果沒有對應的學生資訊,則輸出「no answer!」

示例1

複製

4

01 李江 男 21

02 劉唐 男 23

03 張軍 男 19

04 王娜 女 19502

0301

0403

複製

02 劉唐 男 23

03 張軍 男 19

01 李江 男 21

04 王娜 女 19

03 張軍 男 19

**:

#include #include

#include

using

namespace

std;

struct

student

;int

main()

intm;

cin >>m;

vector

input;

input.resize(m);

for (int i = 0; i < m; i++)

for (int i = 0; i < m; i++)

if (flag==n)}}

system(

"pause");

return0;

}

view code

posted @

2019-03-10 16:06

wangheq 閱讀(

...)

編輯收藏

查詢學生資訊

題目描述 輸入n個學生的資訊,然後進行查詢。輸入 輸入的第一行為n,即學生的個數 n 1000 接下來的n行包括n個學生的資訊,資訊格式如下 01 李江 男 21 02 劉唐 男 23 03 張軍 男 19 04 王娜 女 19 然後輸入乙個m m 10000 接下來會有m行,代表m次查詢,每行輸入...

查詢學生資訊

二分查詢 題目描述 輸入n個學生的資訊,然後進行查詢。輸入 輸入的第一行為n,即學生的個數 n 1000 接下來的n行包括n個學生的資訊,資訊格式如下 01 李江 男 21 02 劉唐 男 23 03 張軍 男 19 04 王娜 女 19 然後輸入乙個m m 10000 接下來會有m行,代表m次查詢...

查詢學生資訊

include include include include include include include include include includeusing namespace std typedef long long ll const int n 1e5 10,mod 1e6 con...