Monday, December 18, 2017

UVa problem solution 414 - Machined Surfaces

problem link:

Discuss: this is simple implementation problem.just find out the minimum blank space of a row. then substitute it from every blank space and sum it down problem will be solve. there is no tricky part in this problem


try your self  before see the code


Sunday, December 17, 2017

UVa problem solution 10420 - List of Conquests

problem link:


Discuss: in this problem you can use map and then can sort the map.or you can just use the string first then sort the string you can use bubble sort. then just store the string in map. then just simply print the map problem will be solve. there is no tricky part in this problem.


try yourself , before see the code



UVa problem solution 12554 - A Special "Happy Birthday" Song!!!

problem link:

Discuss: this is also implementation problem.if you know string then you can simply do it with it. and you can also do it with structure.you can use while to count.and print multiple of 16.


try your self, before see the code



UVa problem solution 12650 - Dangerous Dive

problem link:

Discuss: this a simply implementation problem. in this problem you can use a bool array then just use memset function and changed the value for every return number keep it mind that you should take n+1 th bool array size. and there is no tricky part in this problem


try yourself before see the code


UVa problem solution 12342 - Tax Calculator

problem link:

Discuss: this is simply implementation problem.no tricky part in this problem.just check value of n in ascending order in a while loop and add in any double variable and last of all just use ceil function it will be okay

try yourself before see the code


Sunday, December 10, 2017

UVa problem solution 10107 - What is the Median?

problem link:

Discuss: in this problem you can simply use vector and solve it. there is no tricky part in this problem. all things are describe fully

try yourself before see the code


UVa problem solution 12802 - Gift From the Gods

problem link:

Discuss: In this problem it is common mistake to the integer after double to check weather it is palindrome or prime but the original integer have to checked. and one thing in this problem not describe that less then 2 will be consider as prime.next just check palindrome and prime it'll be okay.


try your self  before see the code



Saturday, December 9, 2017

UVa problem solution 12854 - Automated Checking Machine

problem link:

Discuss: in this problem you can easily use two array. compare the array with each element if they are same then it is not compatible otherwise it is compatible


try yourself before see the code


UVa problem solution 12895 - Armstrong Number

problem link:

Discuss: in this problem you just have to easily find out the number of digit then power every digit with the number of digit and sum it. it will okay to use while loop as well as use string and for loop.

N.B. some output in Udebug is not match to the accepted output.

try  yourself before see the code


Friday, December 8, 2017

UVa problem solution 13148 - A Giveaway

problem link:

Discuss:  in this problem i also code like child.just calculate manually cube root and square root and set or condition for special number and simply check just if condition

try your self before see the code


UVa problem solution 146 - ID Codes

problem link:

Discuss: in this problem we just have to check is there any permutation next to given string. for it there is STL next_permutation() in cpp that will return zero if there no permutation after given string or return the next permutation of string. so we can easily use this STL.

try your self before see the code


Thursday, November 30, 2017

UVa problem solution 102 - Ecological Bin Packing

problem link:

discuss: in this problem you have to combine the color as much it get minimum. there is six combination possibile,so do it lexographically order.


try your self before see the code


Tuesday, October 17, 2017

UVa problem solution 10189 - Minesweeper

problem link:

Discuss: in this problem you just have to simply check the adjacent square.if there is mine then just count it.for simplicity you can use function.then in loop you can print the sum.no need to store it string. use size_t to avoid presentation error.

try your self before see the code


Monday, October 16, 2017

UVa problem solution 489 - Hangman Judge

problem link:

Discuss: in this problem as you can count stroke only unique wrong guess you have to erase all duplicate element from guess string.you may can erase all duplicate element from string also as one correct guess for all same character.and this tricky part  that you can't short guess string using sorting method.and compare and follow the instruction of problem statement.


try yourself before see the code


Wednesday, October 4, 2017

UVa problem solution 119 - Greedy Gift Givers


problem link:


Discuss: In this problem you can easily use vector or structure to solve this problem.
and for presentation error you can use size_t.and there is no tricky part in this problem


try yourself before see the code



Tuesday, September 26, 2017

UVa problem solution 10945 - Mother bear


problem link:


Discuss: Just check each string palindrome or not.there is no tricky part in this programm

try your self before see the code


Monday, September 25, 2017

Sunday, August 27, 2017

UVa problem solution 11286 - Conformity

problem link:



Discuss: In this problem you can simply use array inside map.that will be work done.
no more tricky part in this problem


try yourself before see the code



Sunday, August 13, 2017

UVa problem 10611 - The Playboy Chimp

problem link:


Discuss: just simply handle query. no tricky part in this problem.

try yourself before see the code


Friday, August 11, 2017

UVa problem solution 10165 - Stone Game

problem link:

Discuss: Just simply do xor of all pile. if it is non zero then jack is win otherwise jill

try your self before see the code



UVa problem 12996 - Ultimate Mango Challenge

problem link:

Discuss: this is problem like mango.if you are here then just use khata and pen.


don't see code


UVa problem solution 10110 - Light, more light

problem link:

Discuss: it is simple problem. if the number of divisor is odd then light is on otherwise off. you can determine it with perfect number if it is perfect square number then light off other wise on.


try yourself before see the code


UVa problem solution 10360 - Rat Attack

problem link:

Discuss: in this problem you have calculate all the position value. which is possible near to bomb.for that you can determine the maximum and minimum range from given output by adding and subtracting with the point.then add size to every grid. and obviously largest grid value will give the largest rat.

try your self before see the code


UVa problem 374 - Big Mod

problem link:

Discuss: in this problem you have to careful about big number.for big number you can divide the number and can simply solve the problem recursively.


try your self before see the code


UVa problem solution 11360 - Have Fun with Matrices

problem link:


Discuss: in this problem you just do work with 2D array. to see the input not use string to take input instead you can use "%1d" specifier.then when do transpose matrix you know what is transpose matrix just exchange the variable [i][j] and [j][i].when you do column exchange you can do it with one loop.just exchange the [i][column1] and [i][coulmn2].when do row exchange you can do same thing just [row1][i] and [row2][i] variable exchange.  when you increment and dic you can use modular '%'. it will work. after all it is just a easy problem..


try your self before see the code



Sunday, August 6, 2017

UVa problem solution 10226 - Hardwood Species

problem link:

Discuss: IN this problem you can work with map.just simply take input with map.don't worry about ordering because map is ordered string set.take input string if the length of string is zero then you can stop take input. then just iterate map for sum the second element then in next iterator print the first string of map then percentage the coverage of second element of map. then just print that.


try your self before see the code



UVa problem solution 573 - The Snail

problem link:


Discuss: this is just simple logic problem.just continue a while loop.and check weather it is greater then the height or less then zero. if if not then decrease fatiage factor from every day climbing then increase day.   Be aware of using floating point.


try yourself before see the code


Wednesday, August 2, 2017

UVa problem solution 10179 - Irreducable Basic Fractions

problem link

Discuss: in this problem you can assign n as result.then find the divisor of n. and subtract from the result. you will find the desired result

try yourself before see the code



UVa problem solution 11466 - Largest Prime Divisor

problem link:

Discuss: just find prime factor and replace maximum prime factor with largest one and if there is only one prime factor then print -1 otherwise print the largest one


try yourself before see the code



Saturday, July 29, 2017

UVa problem solution 10684 - The jackpot

problem link:


Discuss: sum all score if the sum less then zero then set sum zero not when only single score is zero.


try yourself before see the code


UVa problem solution 10008 - What's Cryptanalysis?

problem link:

Discuss: in this problem you can use map for repeat the alphabet then copy the second element in the vector then sort it and erase all duplicate element in array. then check vector element with second element of map. if match then print the map element..


try your self before see the code



Friday, July 28, 2017

UVa problem solution 294 - Divisors

problem link:


Discuss: find the divisor of all number then compare it with previous if it is greater then  previous one then replace with maximum and store the number


try yourself before see the code

Thursday, July 27, 2017

UVa problem solution 583 - Prime Factors

problem link:


Discuss: Just find all prime factor. you may have to face trouble with x but give time it's easy present


try your self before see the code


Wednesday, July 26, 2017

UVa problem solution 11827 - Maximum GCD

problem link:


Discuss: in this problem you can take input as string.then convert it to number and push into a vector. and then run a nested loop and send every pair in gcd function. you can euclid algorithm it is efficient to find gcd. and compare return value with previous one if it is greater than that then replace the maximum value.


try your self before see the code



UVa problem solution 12465 - The Turanga Leela Problem

problem link:


Discuss: find the difference between two number.then loop as do prime.


try your self  before see the code



Uva problem solution 13109 Elephants

Discuss: in this problem just sort the weight and then add until weight less or equal maximum weight.
in increase the value of cnt



Friday, July 21, 2017

Uva problem solution 10924 - Prime Words

Problem link:

Discuss: In this problem sum the value of all letter then just check the sum is prime or not..there is no tricky part in this problem


try your self before see the code


Uva problem solution 11677 - Alarm Clock

problem linK

Discuss: In this problem you subtract h1 from h2 and m1 from m2.if the min is negative that means the hours round so add 60 with min and decrease the value of hours by one. and if hours is negative that means day also round so add 24 with hour.then just simply calculate the min.


try your self before see the code



Uva problem solution 10474 - Where is the Marble?

Problem link:

Discuss: you can take input in array or vector and sort that.after sort you can search the query.you can do it with linear or binary search or others there is no problem with time limit.  be aware of test case number it's some time makes trouble.


try yourself before see the code



Uva problem solution 11942 - Lumberjack Sequencing

problem linK:

Discuss: just simply check the array twice. if any of them are ordered then print ordered.otherwise print unordered.

try yourself before see the code



Thursday, July 20, 2017

Uva problem solution 11455 - Behold my quadrangle

problem linK:


Discuss:For Square All sides are equal. For Rectangle Opposite Sides are equal. In this problem opposite sides may be any of two from a,b,c,d such as a b or a c . For Quadrangle sum of all three sides are greater than rest of one side 
tyr yoursefl before see the code

 

Uva problem solution 11577 - Letter Frequency

problem link:


Discuss: in this problem if you simply use map then you'll get result. first search for second value for large number of time. then run another loop to match the value. if the value matched then just print the first element of the map.


try yourself before see the code



Sunday, July 16, 2017

Uva problem solution 10490 - Mr. Azad and his Son!!!!!

problem link:


Discuss: In this problem you have to use mathematical fact. if (2 power k − 1) is prime number then the number is perfect. or to check prime number you have to use the number n not the number generate by formula.


try yourself before see the code


Tuesday, July 11, 2017

Uva problem solution 11349 - Symmetric Matrix

problem link:

Discuss: in this problem you have to check weather a element less then zero or mat[i][j] and mat[n-1-i][n-1-j]  is not equal. if this happen then this matrix is non symmetric else it is symmetric matrix




Uva problem solution 541 - Error Correction

problem link :

Discuss: in this problem you just calculate the sum of row if it not even the increase flag.after it you calculate column as one disorder found twice you also found an odd in column summation also.then increase value of cnt. if flag and cnt one then change the bit.if  both zero then it's ok otherwise corrupt.


try yourself before see the code



Monday, July 10, 2017

Uva problem solution 11520 - Fill the Square

problem link:


Discuss: In this problem you just simply start the loop from 65 and check the [i][j] th element's with adjacent element.if the adjacent element don't match then simply assign [i][j] element to the loop value.


try yourself before see the code



Saturday, July 8, 2017

Uva problem solution 10038 - Jolly Jumpers

problem link:

Discuss:
In this problem you have to first find the difference of successive element.and check is there all digit between 1 to n-1. to do so you can take a bool type array. find difference and check weather the number less then n and bool is true.if bool is true then make it false.if not then it's not jolly.


try yourself  before see the code


Uva problem solution 575 - Skew Binary

problem link:


Discuss:

In this problem you just have to applied simple decimal based conversion system. As the number can big enough you should use string to take input.


try yourself   before see the code


uva problem solution 10469 - To Carry or not to Carry


problem link:

Discuss:  In this problem we just have to do binary AND operation between two digit.and then we get desired value.

try yourself before see the code.



Saturday, June 24, 2017

uva problem solution 913 - Joana and the Odd Numbers

problem link:

Discuss: In this you just you have to simply calculate (((n*(n+2)/2)*3)-6)

try yourself before see the code


Wednesday, June 14, 2017

uva problem solution 543 - Goldbach's Conjecture

problem link:

Discuss:   In this problem you can generate all prime.then compare the smallest problem if it is prime then subtract it from number then compare it with prime number if it is prime number then print both of them or if it is not then increase the value of i;

try yourself before see the code.


uva problem solution 10235 - Simply Emirp

problem link:

Discuss: in this problem you just have to check weather a number is prime or not.you have do it with square root. and then reverse the number and do check again prime number criteria. if it fulfill then it is empri number and obvisouly it should be not equal to previous number. if it is then it is prime


try yourself before see the code



Thursday, June 8, 2017

uva problem solution 11417 - GCD


problem link:

Discuss: in this problem how to find gcd then do the code as in the statement.


try yourself before see the code


uva problem solution 10170 - The Hotel with Infinite Rooms

problem link:

Discuss: In this problem you can use while loop.substitute s from d while d greater then 0.and increase s with one in every loop then print s-1 the number of team members on this day


try yourself before see the code



uva problem solution 1585 - Score

problem link:

Discuss: in this problem you can use for loop for count 0 and a variable to count the position value of 0.if there is sequence of 0's then increase the value of position variable and add it with sum.if it is not 0 then make the value of position variable 1.

try yourself before see the code


uva problem solution 12531 - Hours and Minutes

problem link:

Discuss: in this problem just look at input if the angle is divided by 6 which is angle for every min has a repeated angle.so we just need to check the angle determine weather it has a repeated angle or not.


try yourself before see the code



Wednesday, June 7, 2017

uva problem soltuion 11849 - CD

problem link:

Discuss: In this problem you can easily do with map.you can also do it by for loop. here i am using map.in at just simply increment the number which duplicate.

try yourself before see the code



Tuesday, June 6, 2017

uva problem solution 10935 - Throwing cards away I

problem link:


Discuss: in this problem you have to print first element from queue and pop second element and then push it again in queue. and print the last element.

if you know queue then it's simple problem for you.clear queue using while loop


try yourself before see the code


Monday, June 5, 2017

uva problem solution 494 - Kindergarten Counting Game


problem link:

Discuss : In this problem you can check str[i] th element in range a to z or A to Z
if it is then make word increment and flag=0 if str[i] th element not in the range then make flag again 1.

 try yourself before see the code


Thursday, June 1, 2017

Uva problem solution 11743 - Credit Check


problem link

Discuss: This is just easy applied problem.You can take input using %1d specifier or using char string.then easily calculate the value and check last digit using remainder.

try yourself before see the code


Wednesday, May 24, 2017

uva problem solution 10370 - Above Average


problem link :

Discuss: In this problem you have to make the average of numbers then check linearly which number is greater then the average then just make percentage with total numbers and above the average number.

try yourself before see the code


uva problem solution 10323 - Factorial! You Must be Kidding!!!


problem link

Discuss: it is just kind of tricky problem. you just can do on calculator and convert it in programming language. if it is less then and it's even or greater then 0 and less then 8  then it is underflow. if it is less then 0 and it's a odd or greater then 13 then it's overflow. otherwise you just print the factorial of n


try yourself before see the code


uva problem solution 11839 - Optical Reader



problem link :


Discuss: This is just easy problem to solve.Check the number if it is less then 127 and it's number of one then just print that number.


try yourself before see the code;



Tuesday, May 16, 2017

uva problem solution 11934 - Magic Formula



problem link



Discussion: It is just a simple problem just evaluate the value of function inside loop and change the value of x with the increasing value of i.


try yourself before see the code.


uva problem soultion 382 - Perfection


problem link :

Discussion: just simply make divisor and add them and follow the instruction of problem. make right align with %5 specifier..

try yourself before see the code.



uva problem solution 483 - Word Scramble



problem lInk

Discussion:  There is tricky part in this problem. Many check string in if condition that not equal to whitespace. and else print the reverse word. but at the the end  word there is problem with the check of whitespace and last word don't print. to avoid it in if condition check whitespace and '\0' character. and  in else store the word in another string.

try your self before see the code.


Monday, May 15, 2017

uva problem 371 - Ackermann Functions


problem link

Discussion : It is simple while loop problem.you can do it easily from the description of problem.

At first try yourself,if you can't then only see the code.


uva problem 10591 - Happy Number


problem link

Discussion : In this problem  make sum of every digit of number. if until the sum less then 10 or 1. replace n with sum. if sum=1 then number is happy otherwise unhappy.

at first try yourself,if you can't then only see the code.


uva problem 11650 - Mirror Clock


problem link:


It is just a simple problem to solve.Just subtract hour from 11. if it is less than or equal 0 then add 12 with hour. and for min if it is not equal to zero than subtract min from 60.  and for align use %02 specifier .


at first try yourself but if you can't then only see the code.


11389 - The Bus Driver Problem uva problem



problem linkk:

Discussion : in this problem we just have to sort the evening and morning hours. then add with smallest one with greatest one then compare it with d.  if it exceed then multiple with over time rate


Saturday, May 6, 2017

12614-Earn for future uva problem

problem link:

Discussion: In this problem you just have to find the maximum value of card..and then print it..don't panic with bitwise operator.

here the code..at first try yourself.if you can't then only see the code.otherwise you can't develop yourself in programming.


uva problem-12709 falling ant


problem link:

discussion:  Just compare the value  of H if H is large then downward acceleration also large..
if H and large H is equal then compare the volume of them the large volume should assign to the large volume.

here are the code, before see the code try yourself first. otherwise you can't develop in programmin


Friday, May 5, 2017

138-Street number uva problem

problem link:


#include<stdio.h>
int main()
{
    long long n,x=8,tc=0;
    double n2;
    while(1)
    {
        n2=sqrt((x*x+x)/2);
        n=n2;
        if(n==n2)
        {
            printf("%10lld%10lld\n",n,x);
            tc++;
        }
        if(tc==10)
        break;
        x++;
    }
return 0;
}

Monday, April 24, 2017

uva problem-12897 Decoding baby boss

problem link:


discussion: if you do this program just like compare every element in every exchange  then you will got time limit. so, to avoid this you just set your alphabet order then replace them with desire character. and last compare your alphabet set and replace main string.


try your self first then if you can't see the code,otherwise you can't improve yourself in programming.

Thursday, March 23, 2017

uva problem-12700 Banglawash

problem link:
In this you just you have to simply count win loss tie and draw then just establish a simple logic

Sunday, March 19, 2017

uva problem 10550 - Combination Lock

In this problem you have to find the number of angle you turn the lock to unlock... First there is must three turn so we can count first 3*360 angle then you have to find the minimum distance between the point and have to count the  angle multiplying digit by 9.

try this after trying if you don't understand then only see the code.otherwise you can't improve yourself in programming.

10929 - You can say 11 uva probelm

In this problem you have to determine weather a number is multiple of  11.
Now what you have to just find the sum of all the digit of the number then  divide it by 11.
if it's divisible by 11 then the number also divisible by 11.

Or, just sum the digit of the number which is odd and which is even. then find the difference between the odd position digit sum and even position digit sum. if it's 0 or divisible by 11 then the number also divisible by 11.

at first try yourself, and if you can't after trying then only see the code otherwise you can't improve yourself in programming.

11689 - Soda Surpler uva problem

Problem link:
This is the easy simulation of problem. just make the sum of 'e' and 'f' and play loop till (sum>=cost)
then do temp=sum/cost  and   answer+=sum then sum%=cost and now sum+=sum


if you don't understand after try then only see the code otherwise you can't improve in programming

Thursday, March 16, 2017

uva problem Zapping-12468

problem link:
Discuss:
In this problem you have to find the minimum number of key press need to go desire channel.
You have only two button in your remote. firstly you just make the difference between the channel.
hence the channel from 0 to 99 and you can go backward so if the difference between channel more then or equal 50 then substitute it from 50.
to make difference between two channel you can use abs() function.


at first try yourself, if you can't then only see the code otherwise you can't increase your skill in programming


Saturday, January 14, 2017

Random Thought

I admit university with a lot of ambition .From my childhood i'm very interested about Technology.I fixed it that i will read in Computer Science and Engineering.After my admission i tried to be a best Engineer but due to some upsetness i just left behind from few of my class mate.They know many things about programming.as they have some relative who stduied in CSE.they can answer all thing that sir asked.and sir give his lecture in that level  this is reason that force many students stay behind and stay upset including me.
So,from then i decide that i'll learn programming and i will do better.
Now i know the pain of those students who does not understand his varsity classes.this problem mainly face the rural area students.
that's why i start to write a blog for help those student.
From now i'll write in this blog regularly.it's may help the students who are new commer  in programming as well as who are anxious about programming.