【C++】【队列】【Blah数集】
问题:
1、请问为什么报错?
2、如何处理题目中大规模数据
3、这题的正确思路/写法
4、如何使用函数memset和函数qsort?
5、如何初始化长整型数组
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <windows.h>
#include <stdlib.h>
using namespace std;
int main() {
int x,y;
while(cin>>x && cin>>y){
long long int a[1000001];
int rear=0,front=0;
a[front]=x;
front++;
for(int i=0;i<y;i++){
long long int o=a[front-1]*2+1;
long long int v=a[front-1]*3+1;
int Ze=1000,Chi=1000;
for(int j=0;j<front;j++){
if(a[j]==o && Ze!=0){
Ze=0;
}
if(a[j]==v && Chi!=0){
Chi=0;
}
}
if(Ze==1000){
a[front]=o;
front++;
}
if(Chi==1000){
a[front]=v;
front++;
}
}
cout<<a[y-1]<<endl;
}
return 0;
}
报错详情: