| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:Why time limit exceedIn Reply To:Why time limit exceed Posted by:baichen at 2006-08-31 21:30:52 >
> #include<stdio.h>
> #include<string.h>
> main()
> {int t,i,j,w;
> long n;
> int a[1000001],b[101];
> char s[5];
> //The input of the database
> scanf("%d",&n);
> for(i=1;i<=n;i++)
> scanf("%d",&a[i]);
>
> scanf("%s",s);
> //The input of the query
> scanf("%d",&t);
> for(i=1;i<=t;i++)
> scanf("%d",&b[i]);
> //冒泡法排序
> for(i=1;i<=n-1;i++)
> for(j=1;j<=n-i;j++)
> if(a[j]>a[j+1])
> {w=a[j];
> a[j]=a[j+1];
> a[j+1]=w;
> }
> //The output
> for(i=1;i<=t;i++)
> printf("%d\n",a[b[i]]);
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator