Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么是WA??

Posted by smb at 2008-03-23 20:12:30 on Problem 3544
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator