why do i get a run time error(SIGXFSZ)CodeChef: Practical coding for everyone
import java.util.Scanner;
class Fibo
{
int x;
int y;
Fibo(int a, int b)
{
x=a;
y=b;
}
int fibo2(int z)
{
if(z==1)
return x;
if(z==2)
return y;
int result = (fibo2(z-1)-fibo2(z-2))%1000000007;
if(result >=0)
return result ;
else
return (result+1000000007);
}
}
class Fibo2
{
public static void main(String[] args)
{
int i;
Scanner in = new Scanner(System.in);
short m = in.nextShort();
int n[] = new int[m];
int o[] = new int[m];
int p[] = new int[m];
for (i = 0; i<m ; i++)
{
n[i] = in.nextInt();
o[i] = in.nextInt();
p[i] = in.nextInt();
}
for( i=0; i<m; i++)
{
Fibo ob = new Fibo(n[i],o[i]);
System.out.println(ob.fibo2(p[i]));
}
}
}
//Whats the error?
question: CodeChef: Practical coding for everyone
code : CodeChef: Practical coding for everyone
can someone pls tell why am i getting runtime error here,been stuck here for a while,thankyou
include
define max 100
int main()
{
int n,i;
scanf("%d",&n);
int a[max];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
int num,r,s=0;
num=a[i];
while(num!=0)
{
r=num%10;
num=num/10;
s=s+r;
}
a[i]=s;
}
for(i=0;i<n;i++)
{
printf("\n%d\n",a[i]);
}
return 0;
}
#include<stdio.h>
void main()
{
int a;
float totalmoney;
scanf("%d %f",&a,&totalmoney);
if(a<=2000 && totalmoney<=2000)
{
if(a%5==0 && (a + .50)<=totalmoney)
{
totalmoney=totalmoney-(a+.50);
printf("%.2f",totalmoney);
}
else
printf("%.2f",totalmoney);
}
}
why i am getting run time error in this
Runtime error (NZEC) may occur if you upload a file from package.
Remember when you upload a file from your computer, class needs to be named Main and be in default package.
do anyone know why do we get run time error SIGCONT
This is just one possible option, as mentioned in @admin’s answer, there 4 types: SIGSEGV, SIGABRT, SIGFPE, NZEC
Can someone please tell why this code might be giving Runtime error.
def func(s,k,j):
if j==0:
s[j] = k
elif s[j-1]>k:
func(s,k,j-1)
else:
s[j] = k
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
s = [l[0]]
for i in range(1,len(l)):
if l[i]>=s[len(s)-1]:
s.append(l[i])
else:
func(s,l[i],len(s)-1)
print(len(s), end=" “)
for i in s:
print(i, end=” ")
print()
thanks in advance