为什么我的C ++代码没有执行main函数?

问题描述

我正在学习C ++,并试图通过Hackerearth link

解决此问题。

我在Dev-C ++ 5.11上为此编写了一个基本代码,由于某种原因,它没有运行。

编译器没有错误,我尝试在main()函数中打印内容以查看它正在执行多少代码,并且打印无!

我什至尝试在main()的第一行执行一个无限循环,但是代码结束而没有做任何事情。 这是我的代码

#include <bits/stdc++.h> 

using namespace std;


int main()
{
    int N = 0;
    cin >> N;
    
    int m = N;
    int x1=0,x2=0,y1=0,y2=0;
    int c = 0;
    int cost = 0,total_cost = 0;
    
    int a[1000][1000] = {0};
    
    while(m>0)
    {
        cin >> x1 >> x2 >> y1 >> y2 >> c;
        
        cost = 0;
        
        for(int i = y1; i<y2+1; i++)
        {
            for(int j = x1; j<x2+1; j++)
            {
                if(a[i][j] == 1)
                {
                    cost++;
                }
                else
                {
                    a[i][j] = 1;
                }
            }
        }
        
        total_cost += cost*c;
        
        m--;
    }
    
    cout << total_cost;

}

我是C ++的新手,所以将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)