解题思路:
注意事项:
参考代码:
#include <iostream>
#include <algorithm>
using namespace std;
int main ()
{
int n;
while(cin>>n){
int *p=new int [n];
int res=0;
for(int i=0;i<n;i++){
cin>>*(p+i);
}
sort(p,p+n,greater<int>());
for(int i=0;i<n;i++){
int temp;
cin>>temp;
int j;
for(j=0;j<n;j++){
if(*(p+j)<temp && *(p+j)){
res++;
*(p+j)=0;
break;
}
}
if(j==n){
for(j=n-1;j>=0;j--){
if(*(p+j) && *(p+j)==temp){
*(p+j)=0;
break;
}
}
if(j==-1) res--;
}
}
cout<<res*50<<endl;
}
return 0;
}
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1049 |
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:859 |
上车人数 (C语言代码)浏览:777 |
【金明的预算方案】 (C++代码)浏览:937 |
Cylinder (C语言描述,蓝桥杯)浏览:1247 |
1157题解浏览:711 |
幸运数 (C++代码)浏览:1259 |
A+B for Input-Output Practice (C语言代码)浏览:459 |
1035 题解浏览:779 |
模拟计算器 (C语言代码)浏览:2299 |