daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace ConsoleApp6
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             long N, i, answer = 1;
  10.             do
  11.             {
  12.                 N = Convert.ToInt32(Console.ReadLine());
  13.  
  14.             } while (N < 1 && N > 1000);
  15.  
  16.             long[] A = new long[N];
  17.  
  18.             for (i = 0; i < N; i++)
  19.             {
  20.                 do
  21.                 {
  22.                     A[i] = Convert.ToInt32(Console.ReadLine());
  23.                 } while (A[i] < 1 && A[i] > 1000);
  24.             }
  25.  
  26.             for(i = 0; i < N; i++)
  27.             {
  28.                 answer = (answer * A[i]) % (1000000007);
  29.             }
  30.  
  31.             Console.WriteLine(answer);
  32.         }
  33.     }
  34. }
  35.    
  36. using System;
  37. using System.Linq;
  38. using System.Collections.Generic;
  39. using System.Diagnostics;
  40.  
  41. namespace ConsoleApp6
  42. {
  43.     class Program
  44.     {
  45.         static void Main(string[] args)
  46.         {
  47.             long N, i, answer = 1;
  48.             N = Convert.ToInt32(Console.ReadLine());
  49.  
  50.             var A = Console.ReadLine() // Read the line of space delimited numbers
  51.                 .Split(' ') // Split out by the separator
  52.                 .Select(n => Convert.ToInt64(n)) // Parse each number to long
  53.                 .ToArray(); // Convert to a materialized array
  54.  
  55.             Debug.Assert(A.Length == N, "Site lied to us about N numbers");
  56.  
  57.             for(i = 0; i < N; i++)
  58.             {
  59.                 answer = (answer * A[i]) % (1000000007);
  60.             }
  61.  
  62.             Console.WriteLine(answer);
  63.         }
  64.     }
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top