using System.Numerics;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return(from x in Enumerable.Range(0, n+1)select BigInteger.Pow(2, x)).ToArray();}}
答案2:
using System.Linq;using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0, n+1).Select(x => BigInteger.Pow(2, x)).ToArray();}}
答案3:
using System.Numerics;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0,n+1).Select(x => BigInteger.Pow(2,x)).ToArray();}}
答案4:
using System.Linq;using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0, n +1).Select(i => BigInteger.One << i).ToArray();}}
答案5:
using System;using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){
BigInteger[] result =newBigInteger[n+1];for(int i =0; i < result.Length; i++){
result[i]=(BigInteger)Math.Pow(2,i);}return result;}}
答案6:
using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){var o =newBigInteger[n +1];for(int i =0; i < o.Length; i++)
o[i]= i ==0?1: o[i]= o[i -1]*2;return o;}}
答案7:
using System;using System.Numerics;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0, n +1).Select(x =>(BigInteger)Math.Pow(2, x)).ToArray();}}
答案8:
using System;using System.Linq;using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0, n +1).Select(x =>(BigInteger)Math.Pow(2, x)).ToArray();}}
答案9:
using System.Numerics;using System;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0,n+1).Select(x=>(BigInteger)Math.Pow(2,x)).ToArray();}}
答案10:
using System.Numerics;using System;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0,n+1).Select(x=>(BigInteger)(Math.Pow(2,x))).ToArray();}}
答案11:
using System.Numerics;using System.Linq;using System;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n)=>
Enumerable.Range(0, n+1).Select(power =>newBigInteger(Math.Pow(2, power))).ToArray();}
答案12:
using System.Numerics;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){
BigInteger[] powersOfTwo =newBigInteger[n +1];BigInteger currentPower =1;for(int i =0; i <= n; i++){
powersOfTwo[i]= currentPower;
currentPower = currentPower <<1;}return powersOfTwo;}}
答案13:
using System.Numerics;using System;using System.Linq;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n)=>
Enumerable.Range(0, n+1).Select(e=>newBigInteger(Math.Pow(2,e))).ToArray();}
答案14:
using System.Numerics;using System.Linq;using System;publicclassKata{publicstatic BigInteger[]PowersOfTwo(int n){return Enumerable.Range(0,n+1).Select(cur=>{returnnewBigInteger(Math.Pow(2,cur));}).ToArray();}}
2的幂【难度:0级】:答案1:using System.Numerics;using System.Linq;public class Kata{ public static BigInteger[] PowersOfTwo(int n) { return (from x in Enumerable.Range(0, n+1) select BigInteger.Pow...