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

## 这编译器......

Posted by y20070316 at 2015-05-21 13:43:49 on Problem 1338
```为什么G++ Wrong Answer，C++就Accepted了？

#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

typedef long long LL;
const int N=1501;

int n; LL p[N];	//Query
LL two[N]; int hw,tw;
LL three[N]; int hth,tth;
LL five[N]; int hf,tf;	//Queue

inline int get(void)
{
int id=(two[hw]<three[hth]?2:3);
if (id==2)
id=(two[hw]<five[hf]?2:5);
else id=(three[hth]<five[hf]?3:5);
return id;
}

{
int minid=get(); LL data;
p[++p[0]]=(data=(minid==2?two[hw++]:minid==3?three[hth++]:five[hf++]));
if (minid<=5) five[++tf]=data*5;
if (minid<=3) three[++tth]=data*3;
if (minid<=2) two[++tw]=data*2;
}

int main(void)
{
p[0]=p[1]=1;
two[1]=2,three[1]=3,five[1]=5;
hw=tw=hth=tth=hf=tf=1;

for (int i;i;)
{
scanf("%d",&n);
if (!n) break;
printf("%lld\n",p[n]);
}

return 0;
}```

Followed by: