zoukankan      html  css  js  c++  java
  • 郑州轻工业OJ1400--这不可能是情书吧

    地址: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
    ",st.a);
    		
    	}
    	//printf("%d
    ",x);
    	
    	return 0;
    } 
    



  • 相关阅读:
    页面与服务器的交互,,经典案例
    setInterval和clearInterval
    setAttribute,,,getAttribute,,,,
    字符串拼接
    上下图片连动效果
    文本框获得焦点
    获取机器上的时间
    检测奇偶性
    置顶博文
    P1962 斐波那契数列 题解
  • 原文地址:https://www.cnblogs.com/acmwangpeng/p/5524869.html
Copyright © 2011-2022 走看看