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

6.0

Posted by frkstyc at 2005-10-30 15:07:38
In Reply To:请问C++(vc)的编译器是6.0的还是7.1的,我的代码在7.1下通过编译,提交后compile error Posted by:decster at 2005-10-30 15:05:49
> #include <iostream>
> #include <algorithm>
> #include <fstream>
> using namespace std;
> //std::ifstream cin("test.txt");
> 
> #define size 22
> int poss[size*2];
> int * posm;
> int seq[size];
> int sstack[size];
> int top;
> 
> struct ele{
> 	int pos;
> 	int w;
> };
> 
> ele forsort[size];
> 
> inline bool operator<(const ele& a,const ele& b)
> {
> 	return a.pos<b.pos;
> }
> 
> void work()
> {
> 	int num;
> 	int cur=1;
> 	int index=1;
> 	int pos=1;
> 	top=-1;
> 	cin>>num;
> 	for(int i = 1;i<=num;i++)
> 	{
> 		cin>>seq[i];
> 		for(;cur<=seq[i];cur++)
> 		{
> 			posm[cur] = pos;
> 			pos++;
> 			sstack[++top]=cur;
> 		}
> 		posm[-sstack[top--]] = pos;
> 		pos++;
> 	}
> 	for(int i=1;i<=num;i++)
> 	{
> 		forsort[i].pos=posm[-i];
> 		forsort[i].w= (posm[-i]-posm[i]+1)/2;
> 	}
> 	std::sort(forsort+1,forsort+num+1);
> 	for(int i=1;i<num;i++)
> 		std::cout<<forsort[i].w<<" ";
> 	std::cout<<forsort[num].w<<"\n";
> }
> 
> int main()
> {
> 	int n;
> 	cin>>n;
> 	posm = poss + size;
> 	for(int i = 0;i<n;i++)
> 	{
> 		work();
> 	}
> 	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