3 条题解
-
0
#include <iostream> #include <map> #include <string> using namespace std; int main() { int n; cin >> n; map<string, int> students; for(int i = 0; i < n; i++) { string name; int age; cin >> name >> age; students[name] = age; } for(const auto&student : students) { cout << student.first << " " << student.second << endl; } return 0; }
-
0
#include <bits/stdc++.h>
using namespace std; map<string,string>m; int main(){ int n; string age ; string name; cin>>n; for (int i=1;i<=n;i++) {
cin>> name >> age; m[name]=age; }map<string,string >::iterator it; for (it=m.begin(); it!= m.end() ;it++){ cout<<it->first <<" "<<it ->second; } return 0;
}
- 1
信息
- ID
- 67
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- 递交数
- 710
- 已通过
- 346
- 上传者