Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

10.15.2011

Microsoft Visual Studio 6.0 Professional Edition: Software




Microsoft Visual Studio 6.0 Professional Edition 
100% working links only 
visual basic + c++ ,foxpro




mediafire




http://adf.ly/5NzBg
http://adf.ly/5NzDi
http://adf.ly/5NzES







Best prog e books ever Programming ChallengesSteven S. Skiena, Miguel Revilla: Books

Programming Challenges

Steven S. Skiena, Miguel Revilla: Books:

Programming Challenges

Review

"Skiena and Revilla's new book 'Programming Challenges: The Programming Contest Training Manual' is just the ticket for those interested in a jumpstart to the world of contest programming. With special emphasis on the international ACM collegiate contests, the book's best feature is each chapter's pithy introduction that demystifies a particular scheme or algorithmic approach. The ensemble of these explications coupled with the contest strategy guidelines in the appendix can enable a novice to enhance contest results dramatically in a short time simply by solving the suggested exercises in each chapter. Even contest veterans are likely to be able to find a nugget or two in the explanations and strategies. "Presented in a logical order (contest programming has over a dozen different primary attacks), the book guides readers not only through the techniques and algorithms required but also through a huge set of problems that can be used for training. Solutions can be submitted to Valladolid University's online trainer for quick feedback and reinforcement. "If you're the sort who likes to have a single volume that covers the vast majority of a field, you'll love Skiena and Revilla's new tome." --Rob Kolstad, Ph.D., Head Coach, USA Computing Olympiad

Product Description

The challenges of problems from international programming competitions are an effective way to improve your algorithmic and coding skills and understanding. This volume uses international programming competition-type problems to motivate the study of algorithms, programming, and other topics in computer science. The book includes more than 100 programming challenges, as well as the theory and key concepts necessary for approaching them. Problems are organized by topic, and supplemented by complete tutorial material. Readers gain a concrete understanding of both algorithmic techniques and advanced coding topics. Unique Features: * Offers a wealth of rich programming problems suitable for self-study -- all with on-line judging at www.programming-challenges.com * Presents practice training for all major programming contests -- ACM International Collegiate Programming Contest (ACM ICPC), International Olympiad in Informatics (IOI), and Topcoder Challenge * Serves as a convenient, web-based means of adding a programming component to any algorithms or software engineering course * Contains complete working code for fundamental data structures and graph, string, numerical and geometric algorithms * Provides a brief-yet-thorough treatment of key elements in number theory, geometry, dynamic programming, and graph algorithms * Supports all popular programming languages (C, C++, Pascal, Java) Steven S. Skiena is a member of the faculty of computer science at SUNY Stony Brook and is author of many widely used books, including The Algorithm Design Manual. He received the 2001 IEEE Computer Society Undergraduate Teaching Award. Miguel Revilla is a member of the faculty of computer science at the University of Valladolid, Spain. He is official website archivist of the ACM ICPC and creator/maintainer of the primary robot-judge, contest-hosting website.



Product Details

  • Paperback: 368 pages
  • Publisher: Springer; 1 edition (May 12, 2003)
  • Language: English
  • ISBN-10: 0387001638
  • ISBN-13: 978-0387001630
  • Product Dimensions: 9.2 x 7 x 0.4 inches
DOwnlooad

http://adf.ly/5O108

Encyclopedia of Algorithms

This summary is not available. Please click here to view the post.

How to Solve It: Modern Heuristics By Zbigniew Michalewicz, David B. Fogel : Best algorithm ebook

This summary is not available. Please click here to view the post.

10.14.2011

Repeated String | String problems


Repeated String




Given a string S (containing at most 105 lowercase English letters). You are requested to find out from continuous substrings a string having length from L to H, which appears the most times; if there are more than one answer, find the most length.

Input

There are several test cases (fifteen at most), each formed as follows:
  • The first line contains two positive integers L, H.
  • The second line contains the string S.
The input is ended with L = H = 0.

Output

For each test case, output on a line two integers which are the number of times appearing and the length of the found string, respectively.

Example

Input:
3 5
aabcbcbca
3 5
baaaababababbababbab
1 4
abcd
0 0


Output:
2 4
6 3
1 4

Explanation

Case #1: bcbc occurs twice - at position 3 and position 5 (occurrences may overlap).
Case #2: bab occurs 6 times.
Case #3: abcd occurs 1 time.


MAKING SOLUTION


At first, it is easy to prove that if there exists a substring with the length of K (K > 1) appearing the most times, there must exist another substring with the length of K-1 appearing the same times (it is such a prefix of the substring length K). So we will find the most appearing substring with the length of L to determine the most times T (first result). Then to find the longest substring appearing T times (second result), we just use binary search to solve it.

The key of both steps is counting the number of times that a substring appears. Theoretically we can use a SUFFIX TREE to solve it (easy to find documents over the internet).


10.05.2011

Fibonacci Numbers | Dynamic Programming |

Fibonacci Numbers | Dynamic Programming


The Fibonacci Numbers are described by the recurrence relation
F(n) = F(n-1) + F(n-2) where F(0) = 0 and F(1) = F(1)
If you were told to write a program to find the Nth Fibonacci Number, you would have probably written the following recursive procedure if you didn’t know dynamic programming.
procedure FIND-FIBONACCI-NUMBER(N)   if N<2     return N   else     return FIND-FIBONACCI-NUMBER(N-1)+FIND-FIBONACCI-NUMBER(N-2)
The above procedure is correct and very simple to implement. So what is the problem? Why should you use dynamic programming?
I will illustrate my point with the help of the following table.
Time Taken to execute for different values of N
NNaive MethodDynamic Programming
The value indicated is in milliseconds and 0 implies negligible time.
The values will be different for different machines.
1000
2020
30160
4018820
503025360
The above table clearly shows that the execution time for the naive method increases dramatically for small increases in value of N. The reason for this is that the naive method runs in exponential timewhereas the dynamic programming method runs in linear time!
Next time you get a Time Limit Exceeded (TLE) on CodeChef (or other programming sites), don’t go around complaining on the forum that the program is running fine on your computer. Test your program for large values of N to check whether it runs efficiently or not. If it doesn’t then it means you have to change the technique used to solve the problem.
I am not going to go into the details of dynamic programming as a lot of excellent material for the topic is already available. My objective was to show you the power of dynamic programming to entice you to learn it!.

printf for "double" and "long double" - Unix

printf for "double" and "long double" - Unix:


how to reliably print for "double" and "long double"?
> I've been reading "man 3 printf", but I can't figure it out for
> "double" and "long double".
> here is my system's sizeof's:
> printf("%d %d %d %d\n",sizeof(long
> long),sizeof(float),sizeof(double),sizeof(long double));
> 8 4 8 12
> I guessed "%lld" for "long long", and "%f" for "float".
> how about "double" and "long double"?

This is really a C question rather than a Unix question. If you
have more questions, try comp.lang.c.

Use "%f" for both float and double; a float argument to a variadic
function like printf is automatically promoted to double.

Use "%Lf" for long double.

Or replace the 'f' with 'g' or 'e' to control how the number is
formatted; you can also control the precision.

If this isn't explained clearly in your printf man page (it should
be), try any decent C textbook. K&R2 (Kernighan & Ritchie, _The C
Programming Language_, 2nd edition) is excellent, as is H&S5 (Harbison
& Steele, _C: A Reference Manual_).




We must do something. This is something. Therefore, we must do this.





I COLLECTED IT FOR SELECTING WANTED THINGS HERE...

8.01.2011

Logging Game | CodeChef | optimality program


Logging Game

All submissions for this problem are available.

Logging can be a very mundane job, but Alice and Bob have devised a game to help them pass the time. They take turns choosing a log, and cutting it into 2 smaller logs. The sum of the lengths of the 2 logs equals the length of the original log. The only restriction is that neither of the resulting logs may be shorter than 1 meter in length (but exactly 1 meter is fine). In other words, non-integer lengths are allowed. Alice makes the first cut, and the first logger who cannot make a legal cut loses.

Input

Input begins with an integer T, the number of test cases (less than 450). T test cases follow, each on its own line. Each test case begins with an integer N, the number of logs at the start of the game. N integers follow, giving the initial lengths of the logs. There are at most 7 logs, and the total length of the logs will not exceed 250 meters. Note that the initial lengths of the logs are integers, but logs may be cut to non-integer lengths.

Output

For each test case, output a single line containing the name of the winner of the game, assuming both loggers choose their cuts optimally.

Sample Input

3 1 2 2 3 4 3 7 8 9

Sample Output

Alice Alice Bob

solution LOGGERS(written by David Stolp)

(The notation [x] is used for the floor function: [x] is the greatest integer not exceeding x.)

First off, non-integers are problematic, so consider that for any real numbers x, y, z with x+y=z, either
[x]+[y]=[z] or
[x]+[y]=[z]-1
Conversely, given a real number z and integers x′ and y′ satisfying either
x′+y′=[z] or
x′+y′=[z]-1,
then set x=(z+x′-y′)/2 and y=(z-x′+y′)/2 and we have [x]=x′, [y]=y′, and x+y=z.

Therefore we can restrict cuts to integer lengths, where the resulting logs from a cut sum to either the length of the original log, or the length of the original log minus one. Now the problem is solvable using Grundy numbers. For any length L, we calculate G(L)=mex({G(A) xor G(B) : (A+B=L or A+B=L-1) and A,B>0}). Then for a game with initial lengths of L1,...,LN if G(L1) xor ... xor G(LN) is zero, Bob has a winning strategy. Otherwise Alice has a winning strategy.

solutions

http://www.codechef.com/viewsolution/356370

http://www.codechef.com/OCT10/status/LOGGERS/

http://www.codechef.com/viewsolution/356035





Some sample same problem to refer

FAST-IO : fast input output (i/o) in c++ cpp for programming events

  1. /**************FAST-IO***************/
  2. void getnum( int &x)
  3. {
  4. x=0;
  5. char ch=getchar_unlocked();
  6. while( ch<'0' || ch>'9')
  7. ch=getchar_unlocked();
  8. while( ch>='0' && ch<='9')
  9. {
  10. x= 10*x+ ch-'0';
  11. ch=getchar_unlocked();
  12. }
  13. }
  14. void putnum( int x)
  15. {
  16. char s[30];
  17. int pi=-1;
  18. do{
  19. s[++pi]= (x-x/10*10)+'0';
  20. x/=10;
  21. }
  22. while( x>0);
  23. ++pi;
  24. while( pi)
  25. putchar_unlocked(s[--pi]);
  26. putchar_unlocked(' ');
  27. }
  28. /************************************/