#2327581

Solution for 0030: Sum of Integers by WatsonHeim

Source Code Status Test Cases
    Policy: public     Reviewed: 3    
00.01 sec    0 KB    44 lines     1337 bytes    2017-05-20 03:23
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;
            var Z=Enumerable.Zip(N1,S1,(i,j)=>new{N=i,V=j});
            while(true){
               ss=cins();
               if(ss[0]==0&&ss[1]==0)break;
               Res=Z.Where(i=>i.N==ss[0]&&i.V==ss[1]).Count();
               print(Res);
            }
        }
    }
}


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

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


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags