using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<MyData> data = new List<MyData>();
List<MyData> data0 = new List<MyData>();
List<MyData> data1 = new List<MyData>();
List<MyData> data2 = new List<MyData>();
Button b;
private void Form1_Load(object sender, EventArgs e)
{
data.Clear();
data0.Clear();
data1.Clear();
data2.Clear();
for (int i = 0; i < 30000; i++)
{
MyData d = new MyData();
d.hogehoe = i;
data.Add(d);
if (i < 10000)
{
data0.Add(d);
}
else if (i < 20000)
{
data1.Add(d);
}
else
{
data2.Add(d);
}
}
b = new Button();
b.Text = "実行";
b.Click += new EventHandler(b_Click);
this.Controls.Add(b);
}
void b_Click(object sender, EventArgs e)
{
b.Enabled = false;
int i = 29999;
MyData aheahe;
if (i < 10000)
{
aheahe = this.datafind(data0, i);
}
else if (i < 20000)
{
aheahe = this.datafind(data1, i);
}
else
{
aheahe = this.datafind(data2, i);
}
if (aheahe != null) this.Text = aheahe.hogehoe.ToString();
b.Enabled = true;
}
MyData datafind(List<MyData> kkkkkkkk, int number)
{
MyData mmmm = null;
foreach (MyData md in kkkkkkkk)
{
if (md.hogehoe == number)
{
mmmm = md;
break;
}
}
return mmmm;
}
}
public class MyData
{
public int hogehoe;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgfQogICAgICAgIExpc3Q8TXlEYXRhPiBkYXRhID0gbmV3IExpc3Q8TXlEYXRhPigpOwogICAgICAgIExpc3Q8TXlEYXRhPiBkYXRhMCA9IG5ldyBMaXN0PE15RGF0YT4oKTsKICAgICAgICBMaXN0PE15RGF0YT4gZGF0YTEgPSBuZXcgTGlzdDxNeURhdGE+KCk7CiAgICAgICAgTGlzdDxNeURhdGE+IGRhdGEyID0gbmV3IExpc3Q8TXlEYXRhPigpOwogICAgICAgIEJ1dHRvbiBiOwogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9Mb2FkKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgZGF0YS5DbGVhcigpOwogICAgICAgICAgICBkYXRhMC5DbGVhcigpOwogICAgICAgICAgICBkYXRhMS5DbGVhcigpOwogICAgICAgICAgICBkYXRhMi5DbGVhcigpOwogICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDMwMDAwOyBpKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE15RGF0YSBkID0gbmV3IE15RGF0YSgpOwogICAgICAgICAgICAgICAgZC5ob2dlaG9lID0gaTsKICAgICAgICAgICAgICAgIGRhdGEuQWRkKGQpOwogICAgICAgICAgICAgICAgaWYgKGkgPCAxMDAwMCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkYXRhMC5BZGQoZCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChpIDwgMjAwMDApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZGF0YTEuQWRkKGQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGRhdGEyLkFkZChkKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBiID0gbmV3IEJ1dHRvbigpOwogICAgICAgICAgICBiLlRleHQgPSAi5a6f6KGMIjsKICAgICAgICAgICAgYi5DbGljayArPSBuZXcgRXZlbnRIYW5kbGVyKGJfQ2xpY2spOwogICAgICAgICAgICB0aGlzLkNvbnRyb2xzLkFkZChiKTsKICAgICAgICB9CgogICAgICAgIHZvaWQgYl9DbGljayhvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIGIuRW5hYmxlZCA9IGZhbHNlOwogICAgICAgICAgICBpbnQgaSA9IDI5OTk5OwogICAgICAgICAgICBNeURhdGEgYWhlYWhlOwogICAgICAgICAgICBpZiAoaSA8IDEwMDAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBhaGVhaGUgPSB0aGlzLmRhdGFmaW5kKGRhdGEwLCBpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChpIDwgMjAwMDApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGFoZWFoZSA9IHRoaXMuZGF0YWZpbmQoZGF0YTEsIGkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgYWhlYWhlID0gdGhpcy5kYXRhZmluZChkYXRhMiwgaSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGFoZWFoZSAhPSBudWxsKSB0aGlzLlRleHQgPSBhaGVhaGUuaG9nZWhvZS5Ub1N0cmluZygpOwogICAgICAgICAgICBiLkVuYWJsZWQgPSB0cnVlOwogICAgICAgIH0KICAgICAgICBNeURhdGEgZGF0YWZpbmQoTGlzdDxNeURhdGE+IGtra2tra2trLCBpbnQgbnVtYmVyKQogICAgICAgIHsKICAgICAgICAgICAgTXlEYXRhIG1tbW0gPSBudWxsOwogICAgICAgICAgICBmb3JlYWNoIChNeURhdGEgbWQgaW4ga2tra2tra2spCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmIChtZC5ob2dlaG9lID09IG51bWJlcikKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBtbW1tID0gbWQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIG1tbW07CiAgICAgICAgfQogICAgfQogICAgcHVibGljIGNsYXNzIE15RGF0YQogICAgewogICAgICAgIHB1YmxpYyBpbnQgaG9nZWhvZTsKICAgIH0KfQo=