#7699: 為什麼只有我有RE這個問題><(C++)


yuckhunter (hunter)


RE (SIGSEGV)
執行時期錯誤
記憶體區段錯誤!  Segmentation fault
 有誰能幫我找錯在哪........
#include<stdio.h> #include<stdlib.h> int main(void){ int x; long long int a[10][4]; while(scanf("%d",&x)!=EOF) { for(int i=1;i<=x;i++) { scanf("%lld %lld %lld",&a[i][1],&a[i][2],&a[i][3]); } for(int j=1;j<=x;j++) { if(a[j][1]==1) { printf("%lld\n",a[j][2]+a[j][3]); } else if(a[j][1]==2) { printf("%lld\n",a[j][2]-a[j][3]); } else if(a[j][1]==3) { printf("%lld\n",a[j][2]*a[j][3]); } else if(a[j][1]==4) { printf("%lld\n",a[j][2]/a[j][3]); } } } system("pause"); return 0; } 
 
#10511: Re:為什麼只有我有RE這個問題><(C++)


lmt5108 (魯蛇碼渣)


RE (SIGSEGV)
執行時期錯誤
記憶體區段錯誤!  Segmentation fault
 有誰能幫我找錯在哪........
#include #include int main(void){ int x; long long int a[10][4]; while(scanf("%d",&x)!=EOF) { for(int i=1;i<=x;i++) { scanf("%lld %lld %lld",&a[i][1],&a[i][2],&a[i][3]); } for(int j=1;j<=x;j++) { if(a[j][1]==1) { printf("%lld\n",a[j][2]+a[j][3]); } else if(a[j][1]==2) { printf("%lld\n",a[j][2]-a[j][3]); } else if(a[j][1]==3) { printf("%lld\n",a[j][2]*a[j][3]); } else if(a[j][1]==4) { printf("%lld\n",a[j][2]/a[j][3]); } } } system("pause"); return 0; } 
 



不整理一下你的CODE,

應該沒人會理你

#10999: Re:為什麼只有我有RE這個問題><(C++)


sabina (流雲)


RE (SIGSEGV)
執行時期錯誤
記憶體區段錯誤!  Segmentation fault
 有誰能幫我找錯在哪........
#include #include int main(void){ int x; long long int a[10][4]; while(scanf("%d",&x)!=EOF) { for(int i=1;i<=x;i++) { scanf("%lld %lld %lld",&a[i][1],&a[i][2],&a[i][3]); } for(int j=1;j<=x;j++) { if(a[j][1]==1) { printf("%lld\n",a[j][2]+a[j][3]); } else if(a[j][1]==2) { printf("%lld\n",a[j][2]-a[j][3]); } else if(a[j][1]==3) { printf("%lld\n",a[j][2]*a[j][3]); } else if(a[j][1]==4) { printf("%lld\n",a[j][2]/a[j][3]); } } } system("pause"); return 0; } 
 



不整理一下你的CODE,

應該沒人會理你

 

#include<stdio.h>

#include<stdlib.h>

int main(void)

{

int x;

long long int a[10][4];

while(scanf("%d",&x)!=EOF)

{

  for(int i=1;i<=x;i++)

    scanf("%lld %lld %lld",&a[i][1],&a[i][2],&a[i][3]);

for(int j=1;j<=x;j++)

{

    if(a[j][1]==1)

      printf("%lld\n",a[j][2]+a[j][3]);

    else if(a[j][1]==2)

      printf("%lld\n",a[j][2]-a[j][3]);

    else if(a[j][1]==3)

      printf("%lld\n",a[j][2]*a[j][3]);

    else if(a[j][1]==4)

      printf("%lld\n",a[j][2]/a[j][3]);

  }

}

system("pause");

return 0;

}

 

整理好了唄