Monday, December 10, 2018

Contest Link : Intra NSU Programing Contest Fall 2018 (Replay)
This was another easy contest which arranged by North South University. This contest basically 
arranged for juniors, so most of the problems are quite easy.
I managed to solve 11 problems out of 12 problems during contest period. And off course 1 problem
I can not solve which was a Geometry problem.
Contest Standings: https://toph.co/c/inpc-fall-2018-r/standings
A. Like Old Times Again
Category   : Add Hoc
Complexity : O(1)
This is the most easiest problem of the set. I have a keypad mobile phone and I need to type a 
message "marvel". How many times I need to press the keys to this message ?
If we calculate normally then we can figure out we need to press 13 times. Just print 13 and get 
accepted.
Code: https://pastebin.com/igdZX5X6 
B. Gauss - The Great Mathematician
Category   : Math
Complexity : O(1)
Given 1st term, 2nd term and nth term of a increasing arithmetic series and calculate the 
sum of the series.
At first I calculate total term of the series using the formula:

nth term = a+(n-1)d, d = 2nd term - 1st term  Or, (n-1)d = nth term - a  Or, n-1 = (nth term - a)/d  Or, n = (nth term - a)/d + 1





#include "bits/stdc++.h"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.