郑州轻工业OJ1400--这不可能是情书吧
2015-12-07 20:54
239 查看
地址:http://acm.zzuli.edu.cn/problem.php?id=1400
#include<stdio.h> #include<string.h> #include<stdlib.h> struct stu { char a[110]; int b[110]; }st; /* void bubble(stu st,int n) //定义两个参数:数组首地址与数组大小 { int i,j,t; char temp; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) //注意循环的上下限* if(st.b[i]>st.b[j]) { temp=st.a[i]; st.a[i]=st.a[j]; st.a[j]=temp; t=st.b[i]; st.b[i]=st.b[j]; st.b[j]=t; } } */ int main() { int s,x,i; scanf("%d",&s); //s=s*2; while (s--) { memset(st.a,0,sizeof(st.a)); memset(st.b,0,sizeof(st.b)); getchar(); gets(st.a); x=strlen(st.a); for (i=0;i<x;i++) scanf("%d",&st.b[i]); // int j,t; char temp; for(i=0;i<x-1;i++) for(j=i+1;j<x;j++) /*注意循环的上下限*/ if(st.b[i]>st.b[j]) { temp=st.a[i]; st.a[i]=st.a[j]; st.a[j]=temp; t=st.b[i]; st.b[i]=st.b[j]; st.b[j]=t; } //for (int i=0;i<x;i++) //printf("%d ",st.b[i]); printf("%s\n",st.a); } //printf("%d\n",x); return 0; }
相关文章推荐
- 20151207 spring概要
- VB.NET多线程入门
- ValueAnimator和ObjectAnimator的高级用法
- 复杂数据的写入文件夹
- 字符串、数组、字典
- [置顶] Android Studio中.9.PNG图片的应用
- 谁把中国制造困在“作坊”里?
- HDU 5249 KPI
- codevs1227 方格取数2 注意数组啊啊啊啊啊啊啊啊啊啊
- LinearLayout和RelativeLayout 共有属性
- Android 接口的回调机制
- 本地通知
- AutoReleasePool 原理
- java中抽象类与接口的异同
- codeforce 241div2 D
- mysql远程访问
- HTML5浏览器嵌入窗口程序解决方案
- OpenJudge_P2987 小兔子捡金币
- Course(水题)
- Android代码编码格式的转换