//test用メソッド public void testFunc() { //テスト用リストを3レコード作る dat td = new dat(); td._ueshita = "↑"; td._acquisition_cost = 0; td._pastnowval = 108985; // td._contractval = td._pastnowval+pub_spred; td._nowdatetime = 1950505050; td._pips = 35; myh.Add(td); td = new dat(); td._ueshita = "↑"; td._acquisition_cost = 0; td._pastnowval = 108988; // td._contractval = td._pastnowval + pub_spred; td._nowdatetime = 1950505050; td._pips = 35; myh.Add(td); td = new dat(); td._ueshita = "↓"; td._acquisition_cost = 0; td._pastnowval = 108985; // td._contractval = td._pastnowval + pub_spred; td._nowdatetime = 1950505050; td._pips = 35; myh.Add(td); }
//hidecountの閾値を超えたときに検証対象となる値等を初期化する public void setInitDat(int targetcellcount, int nowval, string ueshita, long nowunixtime, int hidecount, int establishedval, int spred, int losscut, int ret, int ret01, int rikaku, int songiri) { dat td = new dat(); td._targetcells = targetcellcount; td._pastnowval = nowval; td._ueshita = ueshita; td._pastnowdatetime = nowunixtime; td._hidecountval = hidecount;//設定時のhidecount これ以降の値はhidecountupdateに td._establishedval = establishedval; td._spred = spred; td._loss_cut_pips = losscut; td._returns_pips = ret; td._returns01 = ret01; td._acquisition_cost = nowval + spred;//仮想購入価格 td._returns = 0; td._endflg = false; td._maxpipswidth = 0; td._rikaku = rikaku; td._songiri = songiri; myh.Add(td); }
/// <summary> /// Initializes a new instance of the <see cref="HomeView"/> class. /// </summary> public HomeView() { InitializeComponent(); Log = new Log(); Dat = new dat(Log, this, FFxiInstallPath); Tnames = new TopazNames(); var version = GetType().Assembly.GetName().Version; if (version is not null) VersionLb.Content = version.ToString(); }
static void Main(string[] args) { int[] hw = Console.ReadLine().Split().Select(int.Parse).ToArray(); int h = hw[0]; int w = hw[1]; long[][] map = new long[h][]; long[][] ans = new long[h][]; dat[] ls = new dat[h * w]; for (int i = 0; i < h; i++) { string[] s = Console.ReadLine().Split(' '); //map[i] = Console.ReadLine().Split().Select(long.Parse).ToArray(); map[i] = new long[w]; ans[i] = new long[w]; for (int j = 0; j < w; j++) { map[i][j] = long.Parse(s[j]); ans[i][j] = 1; ls[i * w + j] = new dat(map[i][j], i, j); } } Array.Sort(ls, (a, b) => { return(a.a.CompareTo(b.a)); }); //var ls = ls.OrderBy(p => p.a).ToArray(); long sum = 0; for (int i = 0; i < ls.Length; i++) { for (int j = 0; j < 4; j++) { int nextx = ls[i].x + vx[j]; int nexty = ls[i].y + vy[j]; if (0 <= nextx && nextx < h && 0 <= nexty && nexty < w) { if (map[nextx][nexty] < map[ls[i].x][ls[i].y]) { ans[ls[i].x][ls[i].y] += ans[nextx][nexty]; ans[ls[i].x][ls[i].y] %= mod; } } } sum += ans[ls[i].x][ls[i].y]; sum %= mod; } Console.WriteLine(sum % mod); }
//データ登録後のアップデート public void datUpdater(int nowval, long nowunixtime, DataGridView d) { if (flg1) { return; } //リストデータを更新およびgridに転機 int c = myh.Count(); for (int i = 0; i < c; i++) { dat tmpdat = myh[i];//リスト内の構造体は直接操作できないのでコピーを用意する tmpdat._nowval = nowval; tmpdat._nowdatetime = nowunixtime; //ueshitaで分岐 if (myh[i]._ueshita == "↑" && myh[i]._endflg == false) { //最大に離れた値を登録 if (nowval - myh[i]._acquisition_cost > myh[i]._maxpipswidth) { tmpdat._maxpipswidth = nowval - myh[i]._acquisition_cost; tmpdat._maxval = nowval; tmpdat._widthdatetime = nowunixtime; tmpdat._returns = (int)(myh[i]._returns01 * PIPSRATIO) * tmpdat._maxpipswidth; } else if (myh[i]._acquisition_cost - nowval > pub_entryhaba)//エントリー幅を逆方向に超えたときは終了フラグを立てる { tmpdat._endflg = true; } else if (nowval - myh[i]._acquisition_cost > myh[i]._rikaku)//rikaku { tmpdat._endflg = true; } else { tmpdat._returns = (int)(myh[i]._returns01 * PIPSRATIO) * tmpdat._maxpipswidth; } } else if (myh[i]._ueshita == "↓") { //最大に離れた値を登録 if (myh[i]._acquisition_cost - nowval > myh[i]._maxpipswidth) { tmpdat._maxpipswidth = myh[i]._acquisition_cost - nowval; tmpdat._maxval = nowval; tmpdat._widthdatetime = nowunixtime; tmpdat._returns = (int)(myh[i]._returns01 * PIPSRATIO) * tmpdat._maxpipswidth; } else if (nowval - myh[i]._acquisition_cost > pub_entryhaba) { tmpdat._endflg = true; //エントリー幅を逆方向に超えたときは終了フラグを立てる } else if (myh[i]._acquisition_cost - nowval > myh[i]._rikaku) // { tmpdat._endflg = true; } else { tmpdat._returns = (int)(myh[i]._returns01 * PIPSRATIO) * tmpdat._maxpipswidth; } } myh[i] = tmpdat; } //登録時間降順でソート IOrderedEnumerable <dat> sortList = myh.OrderByDescending(rec => rec._pastnowdatetime);//.ThenBy(rec => rec.strID).ThenBy(rec => rec.ID); //グリッドに転記 for (int i = 0; i < c; i++) { //dataGridView1.Rows[end - tdl[i].close_int].Cells[1].Value = tdl[i].close; //dataGridView1.Invoke((Action)(() => //{ d.Invoke((Action)(() => { if (myh[i]._endflg) { d.Rows[i].Cells[1].Value = myh[i]._ueshita; d.Rows[i].Cells[2].Value = myh[i]._establishedval; d.Rows[i].Cells[3].Value = myh[i]._acquisition_cost; d.Rows[i].Cells[4].Value = FromUnixTime(myh[i]._pastnowdatetime).ToString(); d.Rows[i].Cells[5].Value = d.Rows[i].Cells[5].Value; d.Rows[i].Cells[6].Value = d.Rows[i].Cells[6].Value; if (myh[i]._ueshita == "↑") { d.Rows[i].Cells[7].Value = d.Rows[i].Cells[7].Value; d.Rows[i].Cells[8].Value = myh[i]._returns01 * 0.1 * ((int)d.Rows[i].Cells[7].Value); } else { d.Rows[i].Cells[7].Value = d.Rows[i].Cells[7].Value; d.Rows[i].Cells[8].Value = myh[i]._returns01 * 0.1 * ((int)d.Rows[i].Cells[7].Value); } d.Rows[i].Cells[9].Value = myh[i]._endflg; } else { d.Rows[i].Cells[1].Value = myh[i]._ueshita; d.Rows[i].Cells[2].Value = myh[i]._establishedval; d.Rows[i].Cells[3].Value = myh[i]._acquisition_cost; d.Rows[i].Cells[4].Value = FromUnixTime(myh[i]._pastnowdatetime).ToString(); d.Rows[i].Cells[5].Value = myh[i]._nowval; d.Rows[i].Cells[6].Value = myh[i]._nowdatetime; if (myh[i]._ueshita == "↑") { d.Rows[i].Cells[7].Value = myh[i]._nowval - myh[i]._acquisition_cost; d.Rows[i].Cells[8].Value = myh[i]._returns01 * 0.1 * (myh[i]._nowval - myh[i]._acquisition_cost); } else { d.Rows[i].Cells[7].Value = myh[i]._acquisition_cost - myh[i]._nowval; d.Rows[i].Cells[8].Value = myh[i]._returns01 * 0.1 * (myh[i]._acquisition_cost - myh[i]._nowval); } d.Rows[i].Cells[9].Value = myh[i]._endflg; } })); } }