Posts

Image
 MySQL Setup Download MySQL zip (https://dev.mysql.com/downloads/mysql/) Save zip file any location Unzip file Enter bin folder of unzip directory     -  Open a command prompt on this directory path     - Run following command                     mysqld --initialize --console    - Copy temporary generated password         - Run following command                       mysqld --console     For changing password :     - Open a new  command prompt on this bin directory path      - Run following command and press Enter key                mysql -u root -p     - Then command prompt wants password. Please enter the copied password. And press Enter key.     - Then run following command for changing root password.                 alter user 'root'@'localhost' identified by ' NEW PASSWORD ';        write your desire password in NEW PASSWORD position with invert comma.        For example, In my case, I want to set Shoaib05 as root password. Then I executed following comman

10887 - Concatenation of Languages Solution Python

totalCase = int ( input ()) i = 1 while i <= totalCase: m, n = [ int (x) for x in input ().split()] mySet1 = set () for j in range (m): mySet1.add( input ().strip()) mySet2 = set () for j in range (n): mySet2.add( input ().strip()) mySet = set () for x in mySet1: for y in mySet2: mySet.add(x + y) print ( f"Case { i } : { len (mySet) } " ) i += 1

uva-10855 Rotated squares Solution in Python

while True : N , n = [ int (x) for x in input ().split()] if N == 0 and n == 0 : break arr = [[ '' ] * N for i in range (N)] arr0 = [[ '' ] * n for i in range (n)] arr90 = [[ '' ] * n for i in range (n)] arr180 = [[ '' ] * n for i in range (n)] arr270 = [[ '' ] * n for i in range (n)] for i in range (N): s = input () k = 0 for j in s: arr[i][k] = j k += 1 for i in range (n): s = input () k = 0 for j in s: arr0[i][k] = j arr90[k][n - 1 - i] = j arr180[n - 1 - i][n - 1 - k] = j arr270[n - 1 - k][i] = j k += 1 r1 , r2 , r3 , r4 = 0 , 0 , 0 , 0 for i in range (N - n + 1 ): for j in range (N - n + 1 ): t1 = [] for k in range (n): t1.insert(k , arr[i + k][j:j + n]) if t1 == arr0: r1 += 1

uva 10703 - Free spots Solution in Python

while True : w , h , n = [ int (x) for x in input ().strip().split()] if w == 0 and h == 0 and n == 0 : break ls = [] for i in range (h): ls.insert(i , [ 0 ] * w) result = w * h for i in range (n): x1 , y1 , x2 , y2 = [ int (x) for x in input ().strip().split()] if x1 > x2: x1 , x2 = x2 , x1 if y1 > y2: y1 , y2 = y2 , y1 x1 -= 1 y1 -= 1 for j in range (y1 , y2): for k in range (x1 , x2): if ls[j][k] == 0 : result -= 1 ls[j][k] = 1 if result == 0 : print ( "There is no empty spots." ) elif result == 1 : print ( "There is one empty spot." ) else : print ( f"There are { result } empty spots." ) input ()  

UVA-414 Machined Surfaces Solution in Python

while True : x = int ( input ()) if x == 0 : break minimum = 25 ls = [] for i in range (x): s = input ().strip() index1 = s.find( " " ) if index1 >= 0 : index2 = s.find( "X" , index1) delta = index2 - index1 ls.append(delta) if delta < minimum: minimum = delta else : ls.append( 0 ) minimum = 0 result = 0 for i in range (x): result = result + ls[i] - minimum print (result)

Dynamic 2D Array in C++ with explanation

Dynamic 2D Array In C++ Try to create integer 2D array of 4 row and 3 columns. Code snippet: int ** a = new int * [4];//line1 for ( int i = 0; i < 4; i++) {//line2 a[i] = new int [3];//line3 } //line4 Explanation: Let, Address of a is 0x100 and size of int is 4. So, Address of a[0] is 0x100, address of a[1] is 0x104, address of a[2] is 0x108 and so on. a[0]                             a[1]                        a[2]                          a[3] 0x100                       0x104                      0x108                     0x10C 1 st Iteration of line3. Assume receives starting address is 0x500. So, three address is 0x500,0x504,0x508. a[0] = 0x500; 0x500                           0x504                           0x508  Updated value of a is: 0x500 0x100                   0x104                   0x108                 0x10C 2nd Iteration of line3. Assume r

uva 10507 Waking up brain Solution

Waking up brain Solution uva id : erfan05 Accepted Time : 0.000 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string> #include<set> #include<map> using namespace std; typedef set<char> set_char; typedef map<char, set_char> map_char_set_char; typedef map_char_set_char::iterator map_char_set_char_iterator; typedef set_char::iterator set_char_iterator; int main(){ map_char_set_char mymap; set_char_iterator sit,it; map_char_set_char_iterator mit; set_char life,life_progress; string str; char ch1, ch2; int i, n, year, row; while (cin >> n >> row){ cin >> str; life.clear(); life_progress.clear(); mymap.clear(); life.insert(str[0]); life.insert(str[1]); life.insert(str[2]); for (i = 0; i < row; i++){ cin >> str; ch1 = str[0]; ch2 = str[1]; sit = life.find(ch1); if (sit == life.end()){ mit = mymap.find(ch1); if (mit == mymap.