解题思路:
注意事项:
参考代码:
#include<iostream> #include<algorithm> #include<cstring> using namespace std; string sfz[100010]; bool cmp(string x,string y) { string x1,y1; x1=x.substr(6,8); y1=y.substr(6,8); // cout<<x1<<endl<<y1<<endl; if(x1!=y1) { return x1>y1; } else { return x>y; } } int main() { int n,i; cin>>n; for(i=1;i<=n;i++) { cin>>sfz[i]; } sort(sfz+1,sfz+n+1,cmp); for(i=1;i<=n;i++) { printf("%s\n",sfz[i].c_str()); } return 0; }
0.0分
7 人评分
nbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbnbnbnbnbnbnbnbnbnnbnbnbnbnbnbn
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:628 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1067 |
printf基础练习2 (有点不明白)浏览:887 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:672 |
DNA (C语言代码)浏览:440 |
数字游戏 (C++代码)浏览:1240 |
1071题解浏览:585 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:627 |
C语言训练-大、小写问题 (C语言代码)浏览:719 |
汽水瓶 (C语言代码)浏览:579 |