110,534
社区成员
发帖
与我相关
我的任务
分享
public bool TestResult(string s)
{
return s.Length>=9 && s.SubString(0,3).ToUpper()=="HBR" && s.SubString(s.Length-3,3).ToUpper()=="EXE";
}
if(TestResult(strResult))
{
Console.WriteLine("符合");
}
else
{
Console.WriteLine("不符合");
}
633564039022343750
633564039111875000
633564039112031250
D12:89531250
D23:156250
D12/D23:573
class Program
{
public static string A;
public static StringBuilder BA;
public static void Test1(int K)
{
string ret = "";
for (int i = 0; i < K; i++)
{
ret += A;
}
//ret是拼装结果
}
public static void Test2(int K)
{
string ret = "";
for (int i = 0; i < K; i++)
{
BA.Append(A);
}
ret = BA.ToString();
//ret是拼装结果
}
static void Main(string[] args)
{
//A为100个字母K;
A = new String('K', 100);
BA = new StringBuilder();
int K = 10000;
//输出当前时间
long l1, l2, l3;
l1 = DateTime.Now.Ticks;
Console.WriteLine(l1.ToString());
Test1(K);
l2 = DateTime.Now.Ticks;
Console.WriteLine(l2.ToString());
Test2(K);
l3 = DateTime.Now.Ticks;
Console.WriteLine(l3.ToString());
long d12, d23;
d12 = l2 - l1;
d23 = l3 - l2;
Console.WriteLine("D12:{0}", d12);
Console.WriteLine("D23:{0}", d23);
Console.WriteLine("D12/D23:{0}", d12 / (float)d23);
Console.ReadLine();
}
}