Search found 8 matches

Mon Jun 23, 2014 10:09 pm
Forum: Volume 5 (500-599)
Topic: 524 - Prime Ring Problem
Replies: 74
Views: 20002

Re: 524 - The Prime Ring Problem - Is backtracking the only

Thanks for that, but i sent it again but got WA again. What happens when there is a negative number or greater than 16? Should I count them as a blank case?
Like this:

Code: Select all

``````Input:
-1
2
18
``````
should give:

Code: Select all

``````Case 1:

Case 2:
1 2

Case 3:

``````
or i just ignore that cases?
Sat Jun 21, 2014 11:03 pm
Forum: Volume 5 (500-599)
Topic: 524 - Prime Ring Problem
Replies: 74
Views: 20002

Re: 524 - The Prime Ring Problem - Is backtracking the only

I have corrected some mistakes in my initial code, but I still get WA. What I'm missing? #include <stdio.h> #include <stdlib.h> #define MAX 16 int visitados[MAX]; int primos[33]={0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0}; int prim[MAX][MAX]; void primInit(int prim[MAX][MAX] ...
Fri Jun 20, 2014 7:50 pm
Forum: Volume 6 (600-699)
Topic: 639 - Don't Get Rooked
Replies: 11
Views: 9290

Re: 639 - Don't Get Rooked

Forget my last post, it was just because i was considering negative inputs. Added an if ( tam > 0) and got AC.
Fri Jun 20, 2014 7:11 pm
Forum: Volume 6 (600-699)
Topic: 639 - Don't Get Rooked
Replies: 11
Views: 9290

Re: 639 - Don't Get Rooked

I have tried different inputs for the problem and it gives the right answer, but i get WA all the times. Is there anything wrong? or there is a special input for the problem, because what if i read a character that is different to '.' or 'X'? Do i have to consider them as a block or a free space? He...
Thu Jun 19, 2014 4:35 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 193130

Re: 100

I keep getting wrong answer, what i am doing wrong? #include <stdio.h> #include <stdlib.h> int proceso(long num){ int cont = 1; while( num != 1){ if (num % 2 == 1) num = 3*num+1; else num = num/2; cont++; } return cont; } void ciclo3n(int n1,int n2, int *max){ int i; int maximo = proceso(n1); for(i=...
Wed Jun 18, 2014 2:12 am
Forum: Volume 5 (500-599)
Topic: 524 - Prime Ring Problem
Replies: 74
Views: 20002

Re: 524 - The Prime Ring Problem - Is backtracking the only

I tried solving this problem using backtracking but i dont get the right answer for inputs greater than 6. For input 8 i get this: Case 1: 1 2 3 8 5 6 7 4 1 0 5 8 3 4 7 6 1 0 7 4 3 8 5 6 1 4 7 6 5 8 5 2 1 0 0 0 5 8 3 2 Here´s the code: #include <stdio.h> #include <stdlib.h> #define MAX 16 #define MA...
Tue Jun 17, 2014 9:48 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 32860

Re: 495 - Fibonacci Freeze

OMG hahaha you´re right! I got accepted I think i will get a new pair of glasses haha Thank you!
Tue Jun 17, 2014 12:26 am
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 32860

Re: 495 - Fibonacci Freeze

I tried solving this problem using double linked list but i get WA :( . The procedures "anadirDerecha" and "anadirIzquierda" means adding elements at the end and beginning of the list respectively. The process "suma" means adding elements from two list and saving it in the list listaSum and it uses ...