int[] jan = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}
int[] feb = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}
int[] mar = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}
int[] apr = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
public void Add(string item)
using System;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
public static string[] days()
{
string[] days = new string[365];
for (int i = 0; i < 365; i++)
{
days[i] = "Hello";
}
return days;
}
}
}
//C#
public class A
{
public int x, y, z;
public A (int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public int add()
{
return x + y + z;
}
}
public static int BinarySearch(int[] array, int target)
{
int left = 0;
int right = array.Length - 1;
while (left <= right)
{
int middle = (left + right) / 2;
if (array[middle] == target)
return middle;
else if (target < array[middle])
right = middle - 1;
else
left = middle + 1;
}
return -1;
}
translateSat, 12 Nov 2022 public class Solution {
public int FindSecondLargest(int[] nums) {
int maxValue = int.MinValue;
int secondMaxValue = int.MinValue;
foreach (int num in nums) {
if (num > maxValue) {
secondMaxValue = maxValue;
maxValue = num;
} else if (num > secondMaxValue && num < maxValue) {
secondMaxValue = num;
}
}
return secondMaxValue;
}
}
public static int[,] GenerateMatrix(int n)
{
int[,] matrix = new int[n, n];
for (int row = 0; row < n; row++)
{
for (int col = 0; col < n; col++)
{
matrix[row, col] = row + col;
}
}
return matrix;
}
public static string PrintMatrix(int[,] matrix)
{
StringBuilder output = new StringBuilder();
int n = matrix.GetLength(0);
for (int row = 0; row < n; row++)
{
for (int col = 0; col < n; col++)
{
output.Append(matrix[row, col] + " ");
}
output.AppendLine();
}
return output.ToString().TrimEnd();
}
public static class Calendar
{
public static IEnumerable<DateTime> Days(DateTime from, DateTime thru)
{
for(var day = from.Date; day.Date.CompareTo(thru.Date) <= 0; day = day.AddDays(1))
yield return day;
}
}
public class Class1
{
public static int[] ArrayDiff(int[] a, int[] b)
{
var temp=a.Intersect(b).ToArray();
return a.Except(temp).ToArray();
}
}
static int[] MonthDays = new int[12] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static void Main(string[] args)
{
Console.WriteLine(GetDaysOfMonth(3));
}
static int GetDaysOfMonth(int Month)
{
return MonthDays[Month];
}
public class Solution {
public int[][] GenerateMatrix(int n) {
int[][] matrix = new int[n][];
for(int i = 0; i < n; i++){
matrix[i] = new int[n];
}
int i = 1;
int rowStart = 0;
int rowEnd = n-1;
int colStart = 0;
int colEnd = n-1;
while(rowStart <= rowEnd && colStart <= colEnd){
for(int j = colStart; j <= colEnd; j++){
matrix[rowStart][j] = i++;
}
rowStart++;
for(int j = rowStart; j <= rowEnd; j++){
matrix[j][colEnd] = i++;
}
colEnd--;
if(rowStart <= rowEnd){
for(int j = colEnd; j >= colStart; j--){
matrix[rowEnd][j] = i++;
public bool IsValidPassword(string password)
{
if (string.IsNullOrEmpty(password) || password.Length < 8)
{
return false;
}
return true;
}
public string[] months = { "January","February","March","April","May","June","July","August","September","October","November","December"};
Dictionary<string, int> months = new Dictionary<string, int>();
months.Add("Jan", 31);
months.Add("Feb", 28);
months.Add("Mar", 31);
months.Add("Apr", 30);
months.Add("May", 31);
months.Add("Jun", 30);
months.Add("Jul", 31);
months.Add("Aug", 31);
months.Add("Sep", 30);
months.Add("Oct", 31);
months.Add("Nov", 30);
months.Add("Dec", 31);
Calendar<double> doubleCalendar = new Calendar<double>();
doubleCalendar[new DateTime(2012, 1, 1)] = 0.5;
Months = {
"January": 31,
"February": 28,
"March": 31,
"April": 30,
"May": 31,
"June": 30,
"July": 31,
"August": 31,
"September": 30,
"October": 31,
"November": 30,
"December": 31
}
public static List<List<Dictionary<string, object>>> GetMonths()
{
List<List<Dictionary<string, object>>> months = new List<List<Dictionary<string, object>>>();
for (int week = 1; week <= 12; week++)
{
List<Dictionary<string, object>> days = new List<Dictionary<string, object>>();
for (int day = 1; day <= 31; day++)
{
Dictionary<string, object> date = new Dictionary<string, object>();
date.Add("month", week);
date.Add("day", day);
date.Add("date", week + "/" + day);
days.Add(date);
}
months.Add(days);
}
return months;
}
Dictionary<string,int> months = new Dictionary<string,int>();
months.Add("January", 31);
months.Add("February", 28);
public class Day
{
public string Value { get; set; }
public Day(string value)
{
Value = value;
}
}
public class Calendar
{
private List<Day> days;
public Calendar(List<Day> days)
{
this.days = days;
}
public void SetValueAt(int index, string value)
{
this.days[index].Value = value;
}
public string GetValueAt(int index)
{
return this.days[index].Value;
}
public bool IsDayWithValue(string value)
{
return this.days.Any(day => day.Value == value);
}
public int GetIndexOfDayWithValue(string value)
{
for (int i = 0; i < this.days.Count; i++)
{
if (this.days[i].Value == value)
{
return i;
}
}
return -1;
public static IEnumerable<string> Months()
{
return new List<string>
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
}
public class Calendar
{
private int[][] days;
public Calendar(int year, int month)
{
int[] daysInMonth = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int numDaysInMonth = daysInMonth[month];
days = new int[numDaysInMonth][];
for (int i = 0; i < numDaysInMonth; i++)
{
days[i] = new int[24];
}
}
}
double[,] array;
foreach (var item in array)
{
doSomething(item);
}
// array.Initialize()
// Array.Clear(array, 0, array.Length);
public class Calendar
{
// month, days, value
Dictionary<string, Dictionary<string, int>> calendar = new Dictionary<string, Dictionary<string, int>>();
}
void add_two_number()
{
// I can write code here
}
static IList<int> OddNumbers(List<int> lst)
{
return lst.Where(x => x % 2 == 1).ToList<int>();
}
public static int[] DaysPerMonth = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
public static int[] Counts = new int[31];
public class Triplet
{
public int Month { get; private set; }
public int Day { get; private set; }
public int Value { get; private set; }
public Triplet(int month, int day, int value)
{
Month = month;
Day = day;
Value = value;
}
}
public static void Main(string[] args)
{
string line;
List<Triplet> triples = new List<Triplet>();
while ((line = Console.ReadLine()) != null)
{
string[] parts = line.Split(' ');
triples.Add(new Triplet(
Int32.Parse(parts[0]),
Int32.Parse(parts[1]),
Int32.Parse(parts[2])));
}