rancho's blog

By rancho, 11 years ago, In English

This link is really helpful for beginners to learn various algorithm implementation in different available languages. Here it is...

http://en.wikibooks.org/wiki/Algorithm_Implementation

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

By rancho, 11 years ago, In English

How to solve problem 158B? I cannot understand greedy algorithm . What is it actually? Someone experienced help me to learn it.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By rancho, 11 years ago, In English

I cannot fix the problem with my code. It runs well on codeblocks and satisfies the given test cases but when I submit it , it does not produce the desired output, in fact no output is produced. Please help, here's my code.

include<stdio.h>

int main() { int n,m,i; scanf("%d%d",&n,&m); for(i=1;i<=(n+m);i++) { if(n>=m) { if(i%2==0 && i<=2*m) printf("G"); else printf("B"); } else { if(i%2==0 && i<=2*n) printf("B"); else printf("G"); } } return(0); }

Full text and comments »

  • Vote: I like it
  • -14
  • Vote: I do not like it