Guest User

divisors

a guest
Sep 17th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Program
  4. {
  5.     class Solution
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             long n=long.Parse(Console.ReadLine());
  10.             while (n-->0)
  11.             {
  12.                 long m=long.Parse(Console.ReadLine())-1;
  13.                 Console.WriteLine(3L*(m/3L)*((m/3L)+1)/2+5L*(m/5L)*((m/5L)+1)/2-15L*(m/15L)*((m/15L)+1)/2);
  14.             }
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment