Viral Advertising problems.




















































using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HackerDemo
{
    class ViralAdvertising
    {
        public void ViralAdvertisingMain()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int noOfLikes = 0;
            int DefaultShare = 3;
            int initialShare = 5;

            for (int i = 1; i <= n; i++)
            {
                decimal d = (decimal)initialShare / 2;
                int nshare = Convert.ToInt32(Math.Floor(d)) ;
                initialShare = nshare * DefaultShare;
                noOfLikes += nshare;
            }
            Console.WriteLine(noOfLikes);
        }
    }
}

1 comment:

  1. Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. online advertising

    ReplyDelete