晨三娃


私信TA

用户名:13008142306

访问量:21039

签 名:

我的语言,没有对象

等  级
排  名 387
经  验 4965
参赛次数 6
文章发表 28
年  龄 20
在职情况 学生
学  校 西华大学
专  业 计算机科学与技术

  自我简介:

//本着解题的原则,未严格按照题目要求,提供给大家一种思路,大神路过就行,谢谢

#include <iostream>

#include <algorithm>

using namespace std;

struct student{

int number;

float score;

};

int main ()

{

int n,m;

cin>>n>>m;

int *p=new int [n+m];

student *stu=new student [n+m];

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

cin>>(*(stu+i)).number>>(*(stu+i)).score;

*(p+i)=(*(stu+i)).number;

}

sort(p,p+n+m);

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

cout<<*(p+i)<<" ";

for(int j=0;j<n+m;j++){

if((*(stu+j)).number==*(p+i)){

cout<<(*(stu+j)).score;

break;

}

}

cout<<endl;

}

return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区

我也是这么想的,但是有错误答案
2019-03-20 10:09:08
  • «
  • 1
  • »