入门模拟——3.2查找元素 B1041 考试座位号 + long long型存储知识
2019-12-24
14:37:16
#include <bits/stdc++.h> #include<math.h> using namespace std; const int MAX_LEN = 1004; struct Student{ long long number;//学号 int num;//考试座位号 }test[MAX_LEN]; int main(){ int n; cin>>n; for(int i=0;i<n;++i){ long long temp; cin>>temp; int tst; cin>>tst; int num1; cin>>num1; test[tst].num = num1; test[tst].number = temp; } int M; cin>>M; int Mtemp[M]; for(int i=0;i<M;++i){ cin>>Mtemp[i]; } for(int i=0;i<M;++i){ int s = Mtemp[i]; /*for(int i =0;i<MAX_LEN;++i){ if(test[i].) }*/ cout<<test[s].number<<" "<<test[s].num<<endl; } system("pause"); return 0; }