| ||||||||||
| 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:为什么是WA??In Reply To:为什么是WA?? Posted by:smb at 2008-03-23 20:12:30 同问。
> #include<iostream>
> #include<stdio.h>
> #include<math.h>
> #include<string.h>
> #include<algorithm>
> using namespace std;
> struct ar{
> __int64 x;
> int y;
> };
> ar w[1005],pd[1005];
> bool cmp(ar a,ar b)
> {
> if (a.x>b.x)
> return true;
> }
> int main()
> {
> int a[1005];
> int n,i;
> __int64 t,p;
> while(scanf("%dn %lld",&n,&t)!=-1)
> {
> for (i=0;i<n;i++)
> {
> scanf("%lld",&w[i].x);
> w[i].y=i+1;
> }
> sort(w,w+n,cmp);
> for (i=0;i<n;i++)
> {
> scanf("%lld",&pd[i].x);
> pd[i].y=i+1;
> }
> for (i=0;i<n;i++)
> {
> scanf("%lld",&p);
> pd[i].x=p-pd[i].x*t;
> }
> sort(pd,pd+n,cmp);
>
> for (i=0;i<n;i++)
> a[pd[i].y]=w[i].y;
> cout<<a[1];
> for (i=2;i<=n;i++)
> cout<<" "<<a[i];
> cout<<endl;
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator