795 - Sandorf's Cipher

All about problems in Volume 7. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan

795 - Sandorf's Cipher

Post by htl »

I think it's a easy problem. Always getting WA. Could someone give me some test case?
Yeomin
New poster
Posts: 5
Joined: Tue Jul 20, 2004 3:32 pm
Location: Republic of Korea

Sample Input/Output

Post by Yeomin »

Input

1234567890##########1234567890######
###############################12345

Output

851##0851###62##73##974###9#03###642
#########42#######51#######3
Bunda001
New poster
Posts: 6
Joined: Wed Jan 02, 2008 12:45 pm

invocation

Post by Bunda001 »

Hello, please, is someone who can send here that solved program? (code) I really, really need it. PLEASE....
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

Could you please elaborate as to why you desperately need the code as opposed to some hints?
Bunda001
New poster
Posts: 6
Joined: Wed Jan 02, 2008 12:45 pm

answer

Post by Bunda001 »

I wont lie - i need that program to school and i am not a great programmer, so i need help. If you think, that i should do it myself, ok, but people should help each other - and i need it. So thats why. thank you for help....
newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 795 - Sandorf's Cipher

Post by newkid »

Hi,
Can anyone give any critical test case on this? I am getting WA.

Thanks

Here is my code..

Code: Select all

 Got Acc..
Last edited by newkid on Thu Jan 15, 2009 9:27 pm, edited 1 time in total.
hmm..
newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 795 - Sandorf's Cipher

Post by newkid »

Found my bug..

I was compressing the decrypted string from the end if it had '#' there.. I was wrong here.. This should be done after the whole message is decrypted..

the following input might help..
input:

Code: Select all

###############################12345
###############################12345

###############################12345###############################12345
output:

Code: Select all

#########42#######51#######3
#########42#######51#######3

#########42#######51#######3#################42#######51#######3
hmm..
robin_0
New poster
Posts: 7
Joined: Tue Apr 28, 2015 9:47 am

Re: 795 - Sandorf's Cipher

Post by robin_0 »

getting wa :(
Help please :(

Code: Select all

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define OUTPUT freopen("myfile.txt","w",stdout);
#define INPUT freopen("input.txt","r",stdin);
#define MAX 100005

char inp[1005],op[1005];

void decrypt ( int pointer );

int main()
{
    int i,pointer,len,j,bound;

    while(gets(inp))
    {

        len=strlen(inp);
        if(len==0)
            printf("\n");


        for(pointer=0;pointer*36<len;pointer++)
            decrypt(pointer);

        //printf("%d\n",pointer);
        j=(pointer)*36;


        for(i=0;i<len;i++)
        {
            if(op[i]!='#')
            break;
        }


        bound=i;

        //printf("%d\n",bound);

        for(i=len-1 ;i>=bound;i--)
            printf("%c",op[i]);

        printf("\n");
    }


    return 0;
}


void decrypt ( int pointer )
{
    int i=pointer*36;
    op[i+0]=inp[i+1];
    //printf("%c",inp[1]);
    op[i+1]=inp[i+3];
    op[i+2]=inp[i+5];
    op[i+3]=inp[i+10];
    op[i+4]=inp[i+14];
    op[i+5]=inp[i+19];
    op[i+6]=inp[i+22];
    op[i+7]=inp[i+29];
    op[i+8]=inp[i+33];
    op[i+9]=inp[i+8];
    op[i+10]=inp[i+11];
    op[i+11]=inp[i+15];
    op[i+12]=inp[i+18];
    op[i+13]=inp[i+23];
    op[i+14]=inp[i+26];
    op[i+15]=inp[i+28];
    op[i+16]=inp[i+31];
    op[i+17]=inp[i+35];
    op[i+18]=inp[i+2];
    op[i+19]=inp[i+6];
    op[i+20]=inp[i+13];
    op[i+21]=inp[i+16];
    op[i+22]=inp[i+21];
    op[i+23]=inp[i+25];
    op[i+24]=inp[i+30];
    op[i+25]=inp[i+32];
    op[i+26]=inp[i+34];
    op[i+27]=inp[i+0];
    op[i+28]=inp[i+4];
    op[i+29]=inp[i+7];
    op[i+30]=inp[i+9];
    op[i+31]=inp[i+12];
    op[i+32]=inp[i+17];
    op[i+33]=inp[i+20];
    op[i+34]=inp[i+24];
    op[i+35]=inp[i+27];
    //op[i+36]='\0';


}
Post Reply

Return to “Volume 7 (700-799)”