#include<stdio.h>
#include<math.h>
int digit(int A);
void main()
{
int q, c, i, size, T;
long p, N, A, B, x;
scanf("%d", &T);
for(q=0;q<T;q++)
{
scanf("%d",&N);
size=digit(N);
int P[size];
p=N;
for(i=0;i<size;i++)//splitting digits into array
{
x=p%10;
P[i]=x;
p=p/10;
}
for(i=0;i<size;i++)//replacing 4 into 3
{
if(P[i]==4)
{
P[i]=P[i]-1;
}
}
A=0;
for(i=0;i<size;i++)//finding number from array
{
A=A+P[i]*pow(10,i);
}
B=N-A;
printf("Case #%d:%ld %ld\n", q+1, A, B);
}
}
int digit(int A)//function for finding numner of digits in N
{
int c=0;
while(A!=0)
{
A=A/10;
c=c+1;
}
return c;
}
This is my code of Forgone Solution of Qualification Round 2019. I am
getting runtime error in google whereas. in my ide (Codeblocks), it runs
successfully. I don't know what to do now.
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/9664b7f8-dcb0-487a-beee-3cb98da22300%40googlegroups.com.