For a number N, first have to calculate N-1+divisors(N-1) & store it in array (e.g. arr[i]=arr[i-1]+divisors(arr[i-1])).
Make a sequence from 1 to until arr[i] becomes greater than 1000000. Then you will be given two numbers A & B, and you will have to find the number of integers from the above sequence which lies within the range [A,B].
Hints = No critical case. Easy problem.
Continue reading “UVA 11876 – N + NOD (N)”
Simple! Just follow the instructions. Check this line carefully “If the fatigue factor drops the snail’s climbing distance below zero, the snail does not climb at all that day. ” in input section. Because of this I suffered for a while.
Continue reading “UVA 573 The Snail”
Problem Link: https://uva.onlinejudge.org/external/112/11223.pdf
Separate each word from the main line and assign them in a new string/char-array. Then compare the word with each character’s word given in the question’s description.
Continue reading “UVA 11223 – O: dah dah dah!”
11879 – Multiple of 17
Problem Link: https://uva.onlinejudge.org/external/118/11879.pdf
Algorithm: This problem is quite easy. In this, there will be a number which is greater at most 100 digits. So, Its not possible to store it in “long long int” in c++.
We will write a program which will take input a string. If the string contains only 0 then the program will be break, otherwise it will enter in another loop. Before entering I will declare two integer variables ‘reminder’ and ‘i’. I will initialize the reminder variable to 0;
Continue reading “UVA 11879 – Multiple of 17”
Problem Link: https://uva.onlinejudge.org/external/4/414.pdf
using namespace std;