1. 程式人生 > >1.8---3 pb

1.8---3 pb

#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>
using namespace std;
int a[200][200];
int main()
{
int m, n, x, y, sum=0;
scanf("%d%d",&m, &n);
for(int i = 1;i <= m;i++)
{
for(int j = 1;j <= n;j++)
{
cin>>a[i][j];
}
}
x = 1;
y = 1;
while(x<=n)
{
sum += a[x][y];
x++;
}
while(y<=n)
{
sum += a[x][y];
y--;
}
while(x>=1)
{
sum += a[x][y];
x--;
}
while(y>1)
{
sum += a[x][y];
y++;
}
cout<<sum;
return 0;
}

為啥不輸出~~~~無解