Posts

Showing posts from January, 2014
Problem: Cellphone Typing link: UVA 12526 Problem:              We have to say average number of keystroke, we have to press while typing given words of dictionary. Idea:        1.) Just store given words of dictionary in a trie.        2.) Then, for all of these words count , how many keystroke needed to type., at last avrg the sum. Solution:           /************************************************************  *                                                          *  *            ==>>BG_PeaceMind(BISHAL)               @NEPAL *  *************************************************************/  ///AC- rank-81 #include <bits/stdc++.h> #define PI acos(-1.0) #define M 100005 #define S(a) scanf("%d",&a) #define P(a) printf("%d\n",a) #define S2(a,b) scanf("%d%d",&a,&b) #define clr(a) memset(a,0,sizeof(a)) #define SET(a) memset(a,-1,sizeof(a)) #define ff(a) memset(a,false,sizeof(a)) #defin