Skip to main content

One Problem A Day

7 replies [Last post]
Offline
Joined: 22 Feb 2011

Hi friends,

Since last 3 years I am participating in Online Judge Programming. These days I am practicing in Uva Online Judge. I think it is the best place for beginners. These are my performance statistics for various OJ(Online Judge) competitions:-

UVA:- http://felix-halim.net/uva/hunting.php?id=77284

SPOJ:- https://www.spoj.pl/users/abhipr1/

Codechef:- http://www.codechef.com/users/abhipr1

          In such competitions questions are generally based on algorithms. They are really tough to crack. From today onwards I would try to discuss one problem from UVA on daily basis. In UVA we can submit our problems in 4 languages. I would suggest to use CPP. There are two reasons for favoring CPP :-

1) We can use C functions which is really faster than any other language (As problems in these competitions are strictly time bound so execution speed matters a lot)

2) Instead of C if we use CPP we can get advantage of STL(Standard Template Library).

About UVA :- The UVa Online Judge is a web site where you can try solving a number of algorithmic problems by implementing the solution in C, C++, Pascal or Java. The problems are usually described in a few paragraphs and some sample input and output is given for the purpose of illustration.

Getting Started in UVA:-

1) Register on UVA website. http://uva.onlinejudge.org/

2) After registering, choose the "browse problems" link on the lower-left side of the main page. From here, you will be asked to choose which problem set volume you want to browse.

This is the first problem so why not start with the easiest one. So I will discuss the easiest problem "11172: Relational Operator ". This problem asks for whether two inputs are equal, greater than or less than. Isn't it the easiest problem. So nothing to discuss for this problem. Here I have attached my accepted code.

So be ready for tougher problems.smiley

Code in C

PreviewAttachmentSize
11172.jpg9.92 KB
sanjeev's picture
Offline
Joined: 21 Feb 2011
Much awaited from the long long time

Hi Abhishek,

Its really a great initiative taken by you. I wish you could achieve greater height in the programming zone.
Your spoj and codechef rank is bit impressive. Keep the hard work and zeal alive. yes

Although your first solution can be treated as demo. (as you told its the easiest one )

Try to post as a new topic always to discuss every new problem under this section. So that we can deal with different kind of problem seperately.

 

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Offline
Joined: 22 Feb 2011
Re: Much awaited from the long long time

Thanks sir.  I will try my best to discuss all those problems which I have successfully submitted.

sanjeev's picture
Offline
Joined: 21 Feb 2011
I will also try to solve some basic problems ;)

Here is the solution of your first easiest problem in Perl. Other can post the same solution in different languages too.

  1. use strict;
  2. use warnings;
  3.  
  4. my $count;
  5. chomp($count =<STDIN>);
  6. while($count--){
  7. my ($a,$b);
  8. chomp($a = <STDIN>);
  9. chomp($b = <STDIN>);
  10. print "=\n" if($a==$b);
  11. print "<\n" if($a<$b);
  12. print ">\n" if($a>$b);
  13. }

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Offline
Joined: 22 Feb 2011
HI

Really gud initiative iw as active on spoj fr a while(read a week) nw m on gild .

Will try to pitch in or atleast learn something frm here :D

sanjeev's picture
Offline
Joined: 21 Feb 2011
Thanks Sunny. Share with other guys about code sharing here

Its nice to hear from you Sunny that you were involved with spoj earlier and GIld too.

Gild is somewhat easy and like fun. I was 2nd top ranker from Chennai in the month of november and in top 10 from India too.

I think codechef or spoj will add great features to our programming skills. Try to get handsover on codechef and you can share your accepted solution with us or you can share your issues while programming either here or codechef or at your workstation :)

Keep sharing.

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Offline
Joined: 22 Feb 2011
Congrats sir :)    

Congrats sir :)

 

 

sanjeev's picture
Offline
Joined: 21 Feb 2011
Thanks Sunny. If you will

Thanks Sunny.

If you will continuosly use that site you will also get such ranks and you will get bored later. Thats why I left.

Hows it for you now?

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.