解题思路:
注意事项:
参考代码:
#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 人评分
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:468 |
字符串输入输出函数 (Java代码)浏览:1440 |
十->二进制转换 (C语言代码)浏览:1291 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1195 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:506 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1434 |
The 3n + 1 problem (C语言代码)浏览:505 |
蛇行矩阵 (C语言代码)浏览:507 |
上车人数 (C语言代码)浏览:713 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:459 |