| ||||||||||
| 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 | |||||||||
请问C++(vc)的编译器是6.0的还是7.1的,我的代码在7.1下通过编译,提交后compile error#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator