# Monthly Archives: April 2017

## Lightoj 1414 Feb 29

Problem Link: Hints: if 2nd given month is not feb and january ,i will increment the value by 1 and if the first given month is jan or feb and date is less then 29 then i will decrement the … Continue reading

## 1259: Goldbach`s Conjecture

Problem Link Hints: store prime numbers in an vector; then check the n-*it is prime or not for example 6 2 4 3 3 here 2 is prime but (6-2)=4 is not prime in the case of 3+3 here 3 … Continue reading

## 1067: Combinations

We all know the formula of nCr =n!/(r!*(n-r)!) it’s a general formula,but this problem is about nCr %mod it can be done with Modular multiplicative inverse formula of nCr % mod is (f(n)%mod*(((r)^(mod-2))%mod*((n-r)^(mod-2))%mod)%mod; here we need to calculate the result … Continue reading

## 7001 – Bus Problem

Problem Link Algorithm: Kruskal View Code #include <bits/stdc++.h> using namespace std; #define INF 10000000 typedef unsigned long long ll; typedef vector vi; typedef vector< vi > vvi; typedef pair<int, int> ii; typedef vector vii; typedef vector vvii; typedef set … Continue reading

## CSTREET

Problem Link Algorithm: Kruskal View Code #include <bits/stdc++.h> using namespace std; #define INF 10000000 //=======================Starts=========================== typedef unsigned long long ll; typedef vector vi; typedef vector< vi > vvi; typedef pair<int, int> ii; typedef vector vii; typedef vector vvii; … Continue reading

## 1232: Coin Change (II)

It’s a classic problem Ref: Geeksforfgeeks View code #include <bits/stdc++.h> using namespace std; #define INF 10000000 typedef long long ll; typedef vector vi; typedef vector< vi > vvi; typedef pair<int, int> ii; typedef vector vii; typedef vector vvii; typedef set … Continue reading