解题思路:
注意事项:
参考代码:
#include <iostream> #include <algorithm> using namespace std; int main(){ int n; while(cin>>n&&n){ int a[1001],b[1001]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) cin>>b[i]; sort(a,a+n); sort(b,b+n); int i,j; int count=0,lose=0; for(i=0;i<n;){ for(j=0;j<n;j++){ if(a[j]>b[i]){ count++; i++; } else if(a[j]==b[i]) i++; else lose++; } if(j==n) break; } int ans=count-lose; if(ans>0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1049 |
简单的a+b (C语言代码)浏览:491 |
C语言程序设计教程(第三版)课后习题9.4 (Java代码)浏览:1417 |
A+B for Input-Output Practice (VI) (C++代码)浏览:417 |
【亲和数】 (C语言代码)浏览:858 |
本人酷爱递归实现很多问题,这里也是浏览:556 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:703 |
【计算两点间的距离】 (C语言代码)浏览:1482 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:687 |
蚂蚁感冒 (C语言代码)浏览:1326 |