Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
8143 陈万瑄 公交换乘站 C++ 通过 100 0 MS 252 KB 402 2020-10-31 16:13:01

Tests(5/5):


#include<bits/stdc++.h> using namespace std; int a[201],b[201],m,n,t[201],s; int main(){ cin>>m>>n; for(int i=1;i<=m;i++) cin>>a[i]; for(int i=1;i<=n;i++){ cin>>b[i]; for(int j=1;j<=m;j++){ if(b[i]==a[j]) t[++s]=b[i]; } } for(int i=s;i>=1;i--){ for(int j=1;j<=i-1;j++){ if(t[j]>t[j+1]) swap(t[j],t[j+1]); } } for(int i=1;i<=s;i++) cout<<t[i]<<" "; return 0; }


测评信息: