#include <stdio.h>
#include "encoder.h"
#include "encoderlib.h"
void encode(int N, int M[])
{
int i;
int a[64];
int b, c, d, e;
for(i=0; i<N; i++)
{
b=M[i]/64;
c=(M[i]%64)/16;
d=(M[i]%16)/4;
e=M[i]%4;
a[i*4]=b+16*i;
a[i*4+1]=c+4+16*i;
a[i*4+2]=d+8+16*i;
a[i*4+3]=e+12+16*i;
}
for(i=0; i<N*4; i++)
{
printf("%d ", a[i]);
}
for(i=0; i<N*4; i++)
send(a[i]);
return;
}
#include <stdio.h>
#include "decoder.h"
#include "decoderlib.h"
int power(int n, int m)
{
int ans=1;
for(int i=0; i<m; i++)
ans=ans*n;
return ans;
}
void decode(int N, int L, int X[])
{
int i, b, temp1, temp2, temp3;
int temp[16]={};
for(i=0; i<L; i++)
{
temp1=X[i]%4;
temp2=(X[i]%16)/4;
temp3=X[i]/16;
temp[temp3]+=temp1*power(4, 3-temp2);
}
for(i=0; i<L/4; i++)
{
printf("%d ", temp[i]);
}
for(i=0; i<L/4; i++)
{
b = temp[i];
output(b);
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:26:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(i=0; i<N*4; i++)
^~~
encoder.cpp:28:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
return;
^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
752 KB |
Hacked |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1744 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1976 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2008 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
2112 KB |
Hacked |
2 |
Incorrect |
4 ms |
2112 KB |
Hacked |
3 |
Incorrect |
4 ms |
2112 KB |
Hacked |
4 |
Incorrect |
6 ms |
2112 KB |
Hacked |
5 |
Incorrect |
6 ms |
2112 KB |
Hacked |
6 |
Incorrect |
5 ms |
2112 KB |
Hacked |
7 |
Incorrect |
4 ms |
2112 KB |
Hacked |