LEARNING ZONE
ENJOY AND LEARN THE TECHNOLOGY!!!
Tuesday, 22 September 2015
Wednesday, 19 August 2015
PROBLEM IN SHUTTING DOWN MY COMPUTER
After shutting down, my laptop keyboard lights are still on.The Only way i used to off is by long pressing the power button for 5 to 10 seconds
Tuesday, 18 August 2015
I FACED THE PROBLEM IN STARTING HOSTED NETWORK USING CMD
THE ERROR MESSAGE I GOT IS
The group or resource is not in the correct state to perform the requested operation error
THE SOLUTION IS HERE:click here
KNOW HOW TO PRINT THE TOP VIEW OF TREE:
50
| |
30 70
| | | |
20 40 60 80
INORDER TRAVERSAL OF TREE
OUTPUT SHOULD BE OF:20,30,50,70,80
50
| |
30 70
| | | |
20 40 60 80
INORDER TRAVERSAL OF TREE
OUTPUT SHOULD BE OF:20,30,50,70,80
Friday, 23 January 2015
code for James found a love letter his friend Harry has written for his girlfriend. James is a prankster, so he decides to meddle with the letter. He changes all the words in the letter into palindromes. To do this, he follows 2 rules: (a) He can reduce the value of a letter, e.g. he can change 'd' to 'c', but he cannot change 'c' to 'd'. (b) In order to form a palindrome, if he has to repeatedly reduce the value of a letter, he can do it until the letter becomes 'a'. Once a letter has been changed to 'a', it can no longer be changed. Each reduction in the value of any letter is counted as a single operation. Find the minimum number of operations required to convert a given string into a palindrome.
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<string.h>
using namespace std;
int main() {
char c[100000];
unsigned long long int a,b,i,j,k,l,temp,count=0;
cin>>a;
for(i=0;i<a;i++)
{
cin>>c;
k=strlen(c);
if(k%2==0)
{
j=k/2;
temp=j;
l=j-1;
for(;temp!=0;)
{
if(c[j]>=c[l])
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[j]--;
count++;
}
}
else
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[l]--;
count++;
}
}
}
}
else
{
j=k/2;
temp=j;
l=j-1;
j++;
for(;temp!=0;)
{
if(c[j]>=c[l])
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[j]--;
count++;
}
}
else
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[l]--;
count++;
}
}
}
}
cout<<count<<endl;
count=0;
}
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<string.h>
using namespace std;
int main() {
char c[100000];
unsigned long long int a,b,i,j,k,l,temp,count=0;
cin>>a;
for(i=0;i<a;i++)
{
cin>>c;
k=strlen(c);
if(k%2==0)
{
j=k/2;
temp=j;
l=j-1;
for(;temp!=0;)
{
if(c[j]>=c[l])
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[j]--;
count++;
}
}
else
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[l]--;
count++;
}
}
}
}
else
{
j=k/2;
temp=j;
l=j-1;
j++;
for(;temp!=0;)
{
if(c[j]>=c[l])
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[j]--;
count++;
}
}
else
{
if(c[l]==c[j])
{
l--;
j++;
temp--;
}
else
{
c[l]--;
count++;
}
}
}
}
cout<<count<<endl;
count=0;
}
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}
Tuesday, 30 December 2014
program to print the pattern
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,i,j;
clrscr();
printf("enter the number of column");
scanf("%d",&a);
printf("enter the number of row");
scanf("%d",&b);
for(i=0;i<b;i++)
{
for(j=0;j<a;j++)
{
if(i==0||i==b-1)
{
printf("X");
continue;
}
if(j==0||j==a-1)
{
printf("X");
continue;
}
if(i!=0&&j!=0&&i!=b-1&&j!=a-1)
{
if(i==1||i==b-2||j==1||j==a-2)
{
printf("0");
continue;
}
}
printf("X");
}
printf("\n");
}
getch();
}
#include<conio.h>
void main()
{
int a,b,c,i,j;
clrscr();
printf("enter the number of column");
scanf("%d",&a);
printf("enter the number of row");
scanf("%d",&b);
for(i=0;i<b;i++)
{
for(j=0;j<a;j++)
{
if(i==0||i==b-1)
{
printf("X");
continue;
}
if(j==0||j==a-1)
{
printf("X");
continue;
}
if(i!=0&&j!=0&&i!=b-1&&j!=a-1)
{
if(i==1||i==b-2||j==1||j==a-2)
{
printf("0");
continue;
}
}
printf("X");
}
printf("\n");
}
getch();
}
Subscribe to:
Posts (Atom)