柠檬布丁吖 2021-10-09 20:37 采纳率: 33.3%
浏览 45
已结题

报错求解【C++】【队列】【Blah数集】

【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;
}

报错详情:

img


d

  • 写回答

1条回答 默认 最新

  • 柠檬布丁吖 2021-10-09 20:57
    关注
    评论

报告相同问题?

问题事件

  • 系统已结题 10月17日
  • 修改了问题 10月9日
  • 创建了问题 10月9日