using System;
using System.Linq;
publicclass Program {
publicstaticint[] Puzzle(int n) {
return Enumerable.Range(0, n).ToArray();
}
}
02.02
using System;
using System.Linq;
publicclass Program {
publicstaticint[] Puzzle(int n) {
return Enumerable.Range(0, n).Select(x => x * n).ToArray();
}
}
02.03
using System;
using System.Linq;
publicclass Program {
publicstaticint[] Puzzle(int n) {
return Enumerable.Range(0, n).Select(x => x * x).ToArray();
}
}
02.04
using System;
using System.Linq;
publicclass Program {
publicstaticintPuzzle(int[] v) {
return (int)v.Sum(x => (long)x);
}
}
02.05
using System;
using System.Linq;
publicclass Program {
publicstaticintPuzzle(int n) {
return Enumerable.Range(0, n).Sum(x => x * x);
}
}
02.06
using System;
publicclass Program {
publicstaticintPuzzle(string s) {
return s.Length - s.Replace("a", "").Length;
}
}
02.07
using System;
publicclass Program {
publicstaticintPuzzle(string s, char x)
{
return s.Length - s.Replace("" + x, "").Length;
}
}