别的也不多说没直接贴代码

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks; namespace Time20180929_DateTime
{
class Program
{
static void Main(string[] args)
{
/*
* 1.DateTime(Int64):将 DateTime 结构的新实例初始化为指定的刻度数。
* 2.DateTime(Int64, DateTimeKind):将 DateTime 结构的新实例初始化为指定的计时周期数以及协调世界时 (UTC) 或本地时间。
* 3.DateTime(Int32, Int32, Int32):将 DateTime 结构的新实例初始化为指定的年、月和日。
* 4.DateTime(Int32, Int32, Int32, Calendar):将 DateTime 结构的新实例初始化为指定日历的指定年、月和日。
* 5.DateTime(Int32, Int32, Int32, Int32, Int32, Int32):将 DateTime 结构的新实例初始化为指定的年、月、日、小时、分钟和秒。
* 6.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, DateTimeKind) :将 DateTime 结构的新实例初始化为指定年、月、日、小时、分钟、秒和协调世界时 (UTC) 或本地时间。
* 7.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Calendar):将 DateTime 结构的新实例初始化为指定日历的年、月、日、小时、分钟和秒。
* 8.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32):将 DateTime 结构的新实例初始化为指定的年、月、日、小时、分钟、秒和毫秒。
* 9.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, DateTimeKind):将 DateTime 结构的新实例初始化为指定年、月、日、小时、分钟、秒、毫秒和协调世界时 (UTC) 或本地时间。
* 10.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar):将 DateTime 结构的新实例初始化为指定日历的指定年、月、日、小时、分钟、秒和毫秒。
* 11.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, DateTimeKind):将 DateTime 结构的新实例初始化为指定日历的指定年、月、日、小时、分钟、秒、毫秒和协调世界时 (UTC) 或本地时间。
*/ /*
* 1.public DateTime (long ticks):
* 一个日期和时间,以公历 0001 年 1 月 1 日 00:00:00.000 以来所经历的以 100 纳秒为间隔的间隔数来表示。
* ticks 小于 MinValue 或大于 MaxValue。
*/
//时间属性MinValue和MaxValue
long _minval = DateTime.MinValue.Ticks;
long _maxval = DateTime.MaxValue.Ticks;
DateTime _mintime = DateTime.MinValue;
DateTime _maxtime = DateTime.MaxValue;
string desc = "minval:{0}, _maxval:{1}, _mintime:{2}, _maxtime:{3}"; string format = "{0}) The {1} date and time is {2:MM/dd/yy hh:mm:ss tt}";
DateTime dt1 = new DateTime(DateTime.MinValue.Ticks);
DateTime dt2 = new DateTime(DateTime.MaxValue.Ticks); //创建一个传统时间为上午2018/9/29 10:39:50基于名称指定的区域性"en-US"并基于布尔值(指定是否使用系统中用户选定的区域性设文化ticks
long ticks = new DateTime(, , , , , , new CultureInfo("en-US", false).Calendar).Ticks;
DateTime dt3 = new DateTime(ticks); Console.WriteLine(desc, _minval, _maxval, _mintime, _maxtime);
Console.WriteLine(format, , "minimum", dt1);
Console.WriteLine(format, , "maxmum", dt2);
Console.WriteLine(format, , "custom ", dt3);
Console.WriteLine("\nThe custom date and time is created from {0:N0} ticks.", ticks);
Console.WriteLine("\nThe custom date and time is created from {0} ticks.", ticks); /*
minval:0, _maxval:3155378975999999999, _mintime:0001/1/1 0:00:00, _maxtime:9999/12/31 23:59:59
1) The minimum date and time is 01/01/01 12:00:00 上午
2) The maxmum date and time is 12/31/99 11:59:59 下午
3) The custom date and time is 09/29/18 10:39:50 上午 The custom date and time is created from 636,738,143,900,000,000 ticks. The custom date and time is created from 636738143900000000 ticks.
*/ /*
* 2.public DateTime (long ticks, DateTimeKind kind);
* DateTime(Int64, DateTimeKind):将 DateTime 结构的新实例初始化为指定的计时周期数以及协调世界时 (UTC) 或本地时间。
* kind:
* Unspecified 0 表示的时间既未指定为本地时间,也未指定为协调通用时间 (UTC)。
* Utc 1 表示的时间为 UTC。
* Local 2 表示的时间为本地时间
*/
long ticks2 = new DateTime(, , , , , , new CultureInfo("en-US", false).Calendar).Ticks;
Console.WriteLine("2018-09-29 10:39:50");
Console.WriteLine("Unspecified:{0}", new DateTime(ticks2, DateTimeKind.Unspecified));
Console.WriteLine("Utc:{0}", new DateTime(ticks2, DateTimeKind.Utc));
Console.WriteLine("Local:{0}", new DateTime(ticks2, DateTimeKind.Local));
/*
2018-09-29 10:39:50
Unspecified:2018/9/29 10:39:50
Utc:2018/9/29 10:39:50
Local:2018/9/29 10:39:50
*/
/*
* 3.public DateTime (int year, int month, int day);
* DateTime(Int32, Int32, Int32)
* 将 DateTime 结构的新实例初始化为指定的年、月和日。
* year:1-9999,month:0-12,day:1-moth中的天数
*/
DateTime dt4 = new DateTime(, , );
Console.WriteLine("dt4的值为{0}", dt4.ToString());
/*
dt4的值为2018/9/18 0:00:00
*/ /*
* 4.public DateTime (int year, int month, int day, System.Globalization.Calendar calendar);
* DateTime(Int32, Int32, Int32, Calendar):将 DateTime 结构的新实例初始化为指定日历的指定年、月和日。
* year:1-9999,month:0-12,day:1-moth中的天数,Calendar用于解释 year、month 和 day 的日历。
*/
/*
下面的示例调用DateTime(Int32, Int32, Int32, Calendar)构造函数两次实例化两个DateTime值。 第一次调用实例化DateTime通过使用值PersianCalendar对象。 由于波斯日历不能指定为区域性的默认日历,显示日期与波斯历需要单独调用其PersianCalendar.GetMonth, PersianCalendar.GetDayOfMonth,和PersianCalendar.GetYear方法。 构造函数的第二个调用实例化DateTime通过使用值HijriCalendar对象。 该示例将当前区域性更改为阿拉伯语 (叙利亚) 和当前区域性的默认日历更改为回历。 因为回历是当前区域性的默认日历,Console.WriteLine方法使用它来设置日期格式。 还原先前的当前区域性 (这在此情况下是英语 (美国)) 时,Console.WriteLine方法使用当前区域性的默认公历日历来设置日期格式。
*/
Console.WriteLine("Using the Persian Calendar:");
PersianCalendar persian = new PersianCalendar();
DateTime dt5 = new DateTime(,,, persian);
Console.WriteLine(dt5.ToString());
Console.WriteLine("{0}/{1}/{2}\n", persian.GetMonth(dt5),persian.GetDayOfMonth(dt5),persian.GetYear(dt5)); Console.WriteLine("Using the Hijri Calendar:");
CultureInfo dftCulture = Thread.CurrentThread.CurrentCulture; // Define Hijri calendar.
HijriCalendar hijri = new HijriCalendar();
// Make ar-SY the current culture and Hijri the current calendar.
Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-SY");
CultureInfo current = CultureInfo.CurrentCulture;
current.DateTimeFormat.Calendar = hijri;
string dFormat = current.DateTimeFormat.ShortDatePattern;
// Ensure year is displayed as four digits.
dFormat = Regex.Replace(dFormat, "/yy$", "/yyyy");
current.DateTimeFormat.ShortDatePattern = dFormat;
DateTime date2 = new DateTime(,,, hijri);
Console.WriteLine("{0} culture using the {1} calendar: {2:d}", current,GetCalendarName(hijri), date2); // Restore previous culture.
Thread.CurrentThread.CurrentCulture = dftCulture;
Console.WriteLine("{0} culture using the {1} calendar: {2:d}",CultureInfo.CurrentCulture,GetCalendarName(CultureInfo.CurrentCulture.Calendar),date2);
/*
Using the Persian Calendar:
2639/12/20 0:00:00
9/29/2018 Using the Hijri Calendar:
ar-SY culture using the Hijri calendar: 29/09/2018
zh-CN culture using the Gregorian calendar: 2580/3/16
*/ /*
* 5.public DateTime (int year, int month, int day, int hour, int minute, int second);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32)
* 将 DateTime 结构的新实例初始化为指定的年、月、日、小时、分钟和秒。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59
*/
DateTime date1 = new DateTime(, , , , , );
Console.WriteLine(date1.ToString());
/*2018/9/29 11:20:26*/ /*
* 6.public DateTime (int year, int month, int day, int hour, int minute, int second, DateTimeKind kind);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, DateTimeKind)
* 将 DateTime 结构的新实例初始化为指定年、月、日、小时、分钟、秒和协调世界时 (UTC) 或本地时间。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59
*kind:
*Unspecified 0 表示的时间既未指定为本地时间,也未指定为协调通用时间 (UTC)。
*Utc 1 表示的时间为 UTC。
*Local 2 表示的时间为本地时间
*/
DateTime date9 = new DateTime(, , , , , , DateTimeKind.Local);
Console.WriteLine("日期:{0}\nDateTimeKind:{1}", date9, date9.Kind);
/*
日期:2010/8/18 16:32:00
DateTimeKind:Local
*/ /*
*7.public DateTime (int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Calendar)
* 将 DateTime 结构的新实例初始化为指定日历的年、月、日、小时、分钟和秒。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59,
* calendar:用于解释 year、month 和 day 的日历。
*/ /*
*8.public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)
* 将 DateTime 结构的新实例初始化为指定的年、月、日、小时、分钟、秒和毫秒。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59,millisecond:0-999
*/ DateTime date3 = new DateTime(, , , , , , );
Console.WriteLine(date3.ToString("MM/dd/yyyy HH:mm:ss.fff tt"));
/*09/29/2018 13:44:30.555 下午*/ /*
* 9.public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, DateTimeKind)
* 将 DateTime 结构的新实例初始化为指定年、月、日、小时、分钟、秒、毫秒和协调世界时 (UTC) 或本地时间。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59,millisecond:0-999
* kind:枚举值之一,该值指示 year、month、day、hour、minute、second 和 millisecond 指定了本地时间、
* 协调世界时 (UTC),还是两者皆未指定。
*/
DateTime date4 = new DateTime(, , , , , , , DateTimeKind.Local);
Console.WriteLine("{0:M/dd/yyyy h:mm:ss.fff tt} {1}", date4, date4.Kind);
/*
* 9/29/2018 1:48:30.500 下午 Local
*/ /*
* 10.public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar)
* 将 DateTime 结构的新实例初始化为指定日历的指定年、月、日、小时、分钟、秒和毫秒。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59,millisecond:0-999
* calendar:用于解释 year、month 和 day 的日历
*/ /*
下面的示例调用DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar)构造函数两次实例化两个DateTime值。 第一次调用实例化DateTime通过使用值PersianCalendar对象。 由于波斯日历不能指定为区域性的默认日历,显示日期与波斯历需要单独调用其PersianCalendar.GetMonth, PersianCalendar.GetDayOfMonth,和PersianCalendar.GetYear方法。 构造函数的第二个调用实例化DateTime通过使用值HijriCalendar对象。 该示例将当前区域性更改为阿拉伯语 (叙利亚) 和当前区域性的默认日历更改为回历。 因为回历是当前区域性的默认日历,Console.WriteLine方法使用它来设置日期格式。 还原先前的当前区域性 (这在此情况下是英语 (美国)) 时,Console.WriteLine方法使用当前区域性的默认公历日历来设置日期格式。
*/
Console.WriteLine("Using the Persian Calendar:");
PersianCalendar persian2 = new PersianCalendar();
DateTime date5 = new DateTime(, , , , , , , persian2);
Console.WriteLine(date5.ToString("M/dd/yyyy h:mm:ss.fff tt"));
Console.WriteLine("{0}/{1}/{2} {3}{7}{4:D2}{7}{5:D2}.{6:G3}\n",
persian2.GetMonth(date5),
persian2.GetDayOfMonth(date5),
persian2.GetYear(date5),
persian2.GetHour(date5),
persian2.GetMinute(date5),
persian2.GetSecond(date5),
persian2.GetMilliseconds(date5),
DateTimeFormatInfo.CurrentInfo.TimeSeparator); Console.WriteLine("Using the Hijri Calendar:");
// Get current culture so it can later be restored.
CultureInfo dftCulture2 = Thread.CurrentThread.CurrentCulture; // Define strings for use in composite formatting.
string dFormat2;
string fmtString;
// Define Hijri calendar.
HijriCalendar hijri2 = new HijriCalendar();
// Make ar-SY the current culture and Hijri the current calendar.
Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-SY");
CultureInfo current2 = CultureInfo.CurrentCulture;
current2.DateTimeFormat.Calendar = hijri2;
dFormat2 = current.DateTimeFormat.ShortDatePattern;
// Ensure year is displayed as four digits.
dFormat2 = Regex.Replace(dFormat2, "/yy$", "/yyyy") + " H:mm:ss.fff";
fmtString = "{0} culture using the {1} calendar: {2:" + dFormat2 + "}";
DateTime date6 = new DateTime(, , , , , , , hijri2);
Console.WriteLine(fmtString, current2, GetCalendarName(hijri2), date6); // Restore previous culture.
Thread.CurrentThread.CurrentCulture = dftCulture;
dFormat2 = DateTimeFormatInfo.CurrentInfo.ShortDatePattern + " H:mm:ss.fff";
fmtString = "{0} culture using the {1} calendar: {2:" + dFormat2 + "}";
Console.WriteLine(fmtString,
CultureInfo.CurrentCulture,
GetCalendarName(CultureInfo.CurrentCulture.Calendar),
date6); /*
Using the Persian Calendar:
6/19/2018 4:32:18.500 下午
3/29/1397 16:32:18.500 Using the Hijri Calendar:
ar-SY culture using the Hijri calendar: 09/09/1431 16:32:18.500
zh-CN culture using the Gregorian calendar: 2010/8/18 16:32:18.500
*/ /*
* 11.public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, DateTimeKind kind);
* DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, DateTimeKind)
* 将 DateTime 结构的新实例初始化为指定日历的指定年、月、日、小时、分钟、秒、毫秒和协调世界时 (UTC) 或本地时间。
* year:1-9999,month:0-12,day:1-moth中的天数,hour:0-23,minuye:0-59,second:0-59,millisecond:0-999
* calendar:用于解释 year、month 和 day 的日历
* kind:枚举值之一,该值指示 year、month、day、hour、minute、second 和 millisecond 指定了本地时间、
* 协调世界时 (UTC),还是两者皆未指定。
*/
/*
下面的示例调用DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, DateTimeKind)构造函数两次实例化两个DateTime值。 第一次调用实例化DateTime通过使用值PersianCalendar对象。 由于波斯日历不能指定为区域性的默认日历,显示日期与波斯历需要单独调用其PersianCalendar.GetMonth, PersianCalendar.GetDayOfMonth,和PersianCalendar.GetYear方法。 构造函数的第二个调用实例化DateTime通过使用值HijriCalendar对象。 该示例将当前区域性更改为阿拉伯语 (叙利亚) 和当前区域性的默认日历更改为回历。 因为回历是当前区域性的默认日历,Console.WriteLine方法使用它来设置日期格式。 还原先前的当前区域性 (这在此情况下是英语 (美国)) 时,Console.WriteLine方法使用当前区域性的默认公历日历来设置日期格式。
*/
Console.WriteLine("Using the Persian Calendar:");
PersianCalendar persian3 = new PersianCalendar();
DateTime date7 = new DateTime(, , , , , , ,
persian3, DateTimeKind.Local);
Console.WriteLine("{0:M/dd/yyyy h:mm:ss.fff tt} {1}", date7, date7.Kind);
Console.WriteLine("{0}/{1}/{2} {3}{8}{4:D2}{8}{5:D2}.{6:G3} {7}\n",
persian3.GetMonth(date7),
persian3.GetDayOfMonth(date7),
persian3.GetYear(date7),
persian3.GetHour(date7),
persian3.GetMinute(date7),
persian3.GetSecond(date7),
persian3.GetMilliseconds(date7),
date7.Kind,
DateTimeFormatInfo.CurrentInfo.TimeSeparator); Console.WriteLine("Using the Hijri Calendar:");
// Get current culture so it can later be restored.
CultureInfo dftCulture3 = Thread.CurrentThread.CurrentCulture; // Define strings for use in composite formatting.
string dFormat3;
string fmtString3;
// Define Hijri calendar.
HijriCalendar hijri3 = new HijriCalendar();
// Make ar-SY the current culture and Hijri the current calendar.
Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-SY");
CultureInfo current3 = CultureInfo.CurrentCulture;
current3.DateTimeFormat.Calendar = hijri3;
dFormat3 = current3.DateTimeFormat.ShortDatePattern;
// Ensure year is displayed as four digits.
dFormat3 = Regex.Replace(dFormat3, "/yy$", "/yyyy") + " H:mm:ss.fff";
fmtString3 = "{0} culture using the {1} calendar: {2:" + dFormat3 + "} {3}";
DateTime date8 = new DateTime(, , , , , , ,
hijri3, DateTimeKind.Local);
Console.WriteLine(fmtString3, current3, GetCalendarName(hijri3),
date8, date8.Kind); // Restore previous culture.
Thread.CurrentThread.CurrentCulture = dftCulture3;
dFormat3 = DateTimeFormatInfo.CurrentInfo.ShortDatePattern + " H:mm:ss.fff";
fmtString3= "{0} culture using the {1} calendar: {2:" + dFormat3 + "} {3}";
Console.WriteLine(fmtString3,
CultureInfo.CurrentCulture,
GetCalendarName(CultureInfo.CurrentCulture.Calendar),
date8, date8.Kind);
/*
Using the Persian Calendar:
6/19/2018 4:32:18.500 下午 Local
3/29/1397 16:32:18.500 Local Using the Hijri Calendar:
ar-SY culture using the Hijri calendar: 09/09/1431 16:32:18.500 Local
zh-CN culture using the Gregorian calendar: 2010/8/18 16:32:18.500 Local
*/
Console.ReadKey();
}
private static string GetCalendarName(Calendar cal)
{
return Regex.Match(cal.ToString(), "\\.(\\w+)Calendar").Groups[].Value;
}
}
}

C# DateTime的11种构造函数的更多相关文章

  1. C# DateTime的11种构造函数 [Abp 源码分析]十五、自动审计记录 .Net 登陆的时候添加验证码 使用Topshelf开发Windows服务、记录日志 日常杂记——C#验证码 c#_生成图片式验证码 C# 利用SharpZipLib生成压缩包 Sql2012如何将远程服务器数据库及表、表结构、表数据导入本地数据库

    C# DateTime的11种构造函数   别的也不多说没直接贴代码 using System; using System.Collections.Generic; using System.Glob ...

  2. CSS垂直居中的11种实现方式

    今天是邓呆呆球衣退役的日子,在这个颇具纪念意义的日子里我写下自己的第一篇博客,还望前辈们多多提携,多多指教! 接下来,就进入正文,来说说关于垂直居中的事.(以下这11种垂直居中的实现方式均为笔者在日常 ...

  3. [转]Markdown 11种基本语法

    Markdown 11种基本语法 现在是我在学习Markdown时做的笔记.学完这些Markdown的基本使用已经不成问题. 1. 标题设置(让字体变大,和word的标题意思一样) 在Markdown ...

  4. 实现Android操作系统11种传感器介绍

    在Android2.3 gingerbread系统中,google提供了11种传感器供应用层使用. #define SENSOR_TYPE_ACCELEROMETER 1 //加速度 #define ...

  5. Markdown 11 种基础语法

    现在是我在学习Markdown时做的笔记.学完这些Markdown的基本使用已经不成问题. 1. 标题设置(让字体变大,和word的标题意思一样)在Markdown当中设置标题,有两种方式: 第一种: ...

  6. Redis 11种Web应用场景举例

    在"怎样让redis在你的系统中发挥作用"一文中,salvatore 'antirez' sanfilippo告诉我们如何利用redis独有的数据结构处理能力来解决一些常见问题.一 ...

  7. [linux] C语言Linux系统编程-TCP通信的11种状态

    三次握手由client主动发出SYN请求, 此时client处于SYN_SENT状态(第一次握手)当server收到之后会由LISTEN转变为SYN_REVD状态, 并回复client, client ...

  8. Redis能干啥?细看11种Web应用场景

    下面列出11种Web应用场景,在这些场景下可以充分的利用Redis的特性,大大提高效率. 1.在主页中显示最新的项目列表. Redis使用的是常驻内存的缓存,速度非常快.LPUSH用来插入一个内容ID ...

  9. TCP的11种状态

    TCP的11种状态 TCP三次握手建立连接 Tcp头部 六个标志位中,我们要用到三个: SYN:SYN= 1 表示这是一个连接请求或连接接受报文.在建立连接时用来进行同步序号(个人理解是,在建立连接的 ...

随机推荐

  1. scrapy snippet

    1. spider文件 from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors. ...

  2. asp.net中利用JSON进行增删改查中运用到的方法

    //asp.net中 利用JSON进行操作, //增加: //当点击“增加链接的时候”,弹出增加信息窗口,然后,在窗体中输入完整信息,点击提交按钮. //这里我们需要考虑这些:我会进行异步提交,使用j ...

  3. summernote文本编辑内容在前端的显示

    1.summernote文本的编辑与文件的上传 在上一篇文章中,我们写了summernote文本编辑器的使用还有图片文件的上传,http://www.cnblogs.com/jingmin/p/659 ...

  4. CF GukiZ hates Boxes 【二分+贪心】

    Professor GukiZ is concerned about making his way to school, because massive piles of boxes are bloc ...

  5. 洛谷——P1024 一元三次方程求解

    P1024 一元三次方程求解 题目描述 有形如:ax3+bx2+cx+d=0 这样的一个一元三次方程.给出该方程中各项的系数(a,b,c,d 均为实数),并约定该方程存在三个不同实根(根的范围在-10 ...

  6. POJ1386Play on Words(欧拉回路)

                                                             Play on Words Time Limit: 1000MS   Memory L ...

  7. Linux查看内核信息或系统信息

    先说说为什么会写这个.这是我去面试的时候面试官问的一个问题,我感觉是一个普遍会被问到的问题.为了让我自己记住,也便于收集下Linux运维方向考官的题目. 第一,查看内核信息 cat /proc/ver ...

  8. [BZOJ4530]大融合

    LCT维护子树信息 维护两个子树信息,$vinf_x$表示节点$x$的所有轻儿子子树信息,$inf_x$表示以$x$为根的LCT子树(包含虚边)的信息 对$vinf$: access时,断开$x$的原 ...

  9. 【线段树】Codeforces Round #393 (Div. 1) C. Nikita and stack

    就是给你一些元素的进栈 出栈操作,不按给定的顺序,要求你对于每次输入,都依据其及其之前的输入,判断出栈顶的元素是谁. 用线段树维护,每次push,将其位置的值+1,pop,将其位置的值-1.相当于寻找 ...

  10. 【树链剖分】【线段树】bzoj3083 遥远的国度

    记最开始的根为root,换根之后,对于当前的根rtnow和询问子树U而言, ①rtnow==U,询问整棵树 ②fa[rtnow]==U,询问除了rtnow所在子树以外的整棵树 ③rtnow在U的子树里 ...