#2327584

Solution for 0030: Sum of Integers by WatsonHeim

Source Code Status Test Cases
    Policy: public     Reviewed: 8    
00.01 sec    9488 KB    46 lines     1348 bytes    2017-05-20 03:25
using System;
using System.Collections.Generic;
using System.Linq;


namespace Library
{
    public class Miscelleneous
    {
        public static void print(object j){Console.WriteLine(j.ToString());}
        public static void print(string s){Console.WriteLine(s);}
        public static int cin(){return int.Parse(Console.ReadLine());}
        public static int[] cins(){
            string[] ss=Console.ReadLine().Split(' ');
            var res=new int[ss.Length];
            for(int i=0;i<ss.Length;i++)
                res[i]=int.Parse(ss[i]);                
            return res;            
        }
        
        public static void Main(){
            
            int[] ss;
            int[] N1=new int[1024];
            int[] S1=new int[1024];
            int c1,v;
            for(int i=0;i<1024;i++){
                c1=Enumerable.Range(0,10).Select(k=>((i>>k)&1)==1).Where(k=>k).Count();
                v=Enumerable.Range(0,10).Select(k=>((i>>k)&1)==1?k:0).Sum();
                N1[i]=c1;S1[v]=v;
            }
            int Res;
            while(true){
               ss=cins();
               Res=0;
               if(ss[0]==0&&ss[1]==0)break;
               for(int i=0;i<1024;i++){
                   if(N1[i]==ss[0]&&S1[i]==ss[1])Res++;
               }
               print(Res);
            }
        }
    }
}


Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 0/1 C# CPU: 00.01 sec Memory: 9488 KB Length: 1348 B 2017-05-20 03:25 2017-05-20 03:25
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Wrong Answer 00.01 sec 9488 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags