Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C# by registered user Shadow ( 16 years ago )
using System;
using System.Collections.Generic;
using System.Text;

namespace Task
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int a = int.Parse(s[1]);
            int b = int.Parse(s[2]);
            int c = int.Parse(s[3]);
            int v = 0;
            int max2 = n / 2;
            int min2 =(int)Math.Ceiling(((double)n - (double)b-0.5*a) / 2);
           
            if((a*0.5+b+c*2)>=n)
            for (int i = 0; i <= a; i+=2)
                for (int j = 0; j <= b; j++)
                    for (int h =min2; h <= max2; h++)
                        if (n == (0.5 * i + j + 2 * h))
                            v++;
          
                Console.WriteLine(v);

        }
     }
 }

 

Revise this Paste

Your Name: Code Language: