Home

Yupの開発日記

japan vs paraguay

  • 2010-06-30 (Wed)
  • Prog

i am watching fifa world cup 2010 south africa on tv
Frank De Bleeckere ‘s judge is somehow wrong… what… what…

string s = “”+chでうまく代入されない

  • 2010-06-20 (Sun)
  • C++
char ch='A';
string s = ""+ch;
cout << s << endl;

これ実行すると,Aが出力されない.なーんでだ

2005 Problem D.Traveling by Stagecoach

  • 2010-06-19 (Sat)
  • ICPC

残っている馬券と場所でdijkstra

#include <iostream>
#include <queue>
#include <string.h>
using namespace std;
#define MAXN (10+1)
#define MAXM (30+1)
#define DM (1024+1) // 2^10 + 1
#define INF (1<<20)
int N,M,P,A,B;
int T[MAXN];
int F[MAXM][MAXM];
double D[MAXM][DM];
bool visited[MAXM][DM];

class State {
public:
  int p,use; // point, use, cost
  double c;
  State(int p,int use,double c) : p(p),use(use),c(c) {}
  bool operator < (const State &s) const {
    return c > s.c;
  }
};

double solve(int all) {
  memset(visited,0,sizeof(visited));
  for(int i=1;i<=M;i++) {
    for(int j=0;j<DM;j++) {
      visited[i][j] = false;
      D[i][j] = INF;
    }
  }
  priority_queue<State> PQ;
  PQ.push(State(A,0,0));
  D[A][0] = 0;
  while(!PQ.empty()) {
    State u = PQ.top(); PQ.pop();
    int p = u.p; int use=u.use;
    double c = u.c;
    if(p == B) {
      return D[p][use];
    }
    if(visited[p][use]) continue;
    if((use & all) == all) continue; // have no ticket
    visited[p][use] = true;

    for(int i=1;i<=M;i++) { // pos
      if(i==p) continue;
      if(F[p][i] >= INF) continue;
      for(int j=1;j<=N;j++) { // ticket
	int use2;
	if((use2=(use|(1<<j))) == use) continue;
	double cost = D[p][use] + (double)F[p][i]/T[j];
	if(cost < D[i][use2]) {
	  D[i][use2] = cost;
	  //printf("cost=%lf\n",cost);
	  PQ.push(State(i,use2,cost));
	}
      }
    }   

  }
  return -1;
}

main() {
  while(cin>>N>>M>>P>>A>>B,N) {
    for(int i=0;i<MAXM;i++) {
      for(int j=0;j<MAXM;j++) {
	F[i][j] = INF;
      }
    }
    for(int i=1;i<=N;i++) cin>>T[i];
    for(int i=1;i<=P;i++) {
      int x,y,z; cin>>x>>y>>z;
      F[x][y]=F[y][x] = z;
    }
    //puts("calc all...");
    int all=0;
    for(int i=0;i<N;i++) all = (all<<1) + 1;
    all <<= 1; // 1-origin
    //printf("solving...\n");
    double ans = solve(all);
    if(ans==-1) puts("Impossible");
    else cout << ans << endl;
  }
}

(HHKB Pro) Happy Hacking Keyboard Professional 購入

  • 2010-06-17 (Thu)
  • Prog

PFU Happy Hacking Keyboard Professional 購入しました.Pro2 ではないでーす

使用感: Delete KeyとEnterキーの位置がJISキーボードと異なるので戸惑った.

やはり高級キーボードというだけあって,スムースに打てるし,疲労を感じさせない.

Yahoo!BB 速度が1/10になった

  • 2010-06-05 (Sat)
  • Prog

Yahoo!BB ADSL 8Mbps を使用していますが,先週から速度が6Mbps から 0.6Mbps まで落ちました.

そこで,サポートセンターにアクセスし,

https://ybb.softbank.jp/support/inquiry/member/?mode=tech

最後の自由記述欄に,回線調整お願いします.と書いておきます.

1営業日〜2営業日後にYahoo!BBのメルアドに,回線調整した件についてメールがきます.

私は改善されなかったので,モデム交換をお願いしました.

今日モデムが到着して元通りの速度が出ています!

PFUにて,HHKB Pro2のプレゼント

  • 2010-05-29 (Sat)
  • Prog

PFUにて,Happy Hacking Keyboard Professional 2 のプレゼントキャンペーンがあっていたので応募してみた.

http://www.pfu.fujitsu.com/hhkeyboard/50th_campaign/?hhkb=pr2

キャンペーン賞品 および 当選数

A賞: HHKB Professional2 特別モデル
HHKB Professional2(無刻印)の製造第1号機(シリアルナンバー1番)に記念キートップ「HHKB Blue Key」を同梱!

※白モデル/墨モデル 各1台

「HHKB Professional2+HHKB Blue Key」 合計2名様

MacBookのキーボードは打ちにくい.HHKB Pro当たったら最高だなと!しかも無刻印じゃないかと!!!!お願いします!あたってください!

郵便番号(KEN_ALL.LZH)

  • 2010-05-16 (Sun)
  • Prog

日本郵便のKEN_ALL.LZHの仕様がおかしい。

こんなもの使い物にならないので、何かいいサービスないかなと探したらあった!

http://zipcloud.ibsnet.co.jp/

このサイトすごいなぁと!利用させていただくということでーす!

DataGridView の行を削除する

  • 2010-05-12 (Wed)
  • C++

DataGridView->Rows->Clear() ではエラーになるでーす

DataSetをクリア、DataTableをクリア、などの方法でできるらしいだ。

http://social.msdn.microsoft.com/Forums/ja-JP/vbexpressja/thread/684a1430-8f4e-4ff4-bc85-739e279cf331

DataSet + BindingNavigator + TextBox

  • 2010-05-09 (Sun)
  • C++

Windows フォームのプログラミング

方法 : Windows フォームの BindingNavigator コントロールを使用して DataSet を移動する
#using <System.dll>
#using <System.Data.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.EnterpriseServices.dll>
#using <System.Transactions.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Collections::Generic;
using namespace System::ComponentModel;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Data::SqlClient;
using namespace System::Windows::Forms;

// This form demonstrates using a BindingNavigator to display
// rows from a database query sequentially.
public ref class Form1 : public Form
{
    // This is the BindingNavigator that allows the user
    // to navigate through the rows in a DataSet.
    BindingNavigator^ customersBindingNavigator;

    // This is the BindingSource that provides data for
    // the Textbox control.
    BindingSource^ customersBindingSource;

    // This is the TextBox control that displays the CompanyName
    // field from the the DataSet.
    TextBox^ companyNameTextBox;

public:
    Form1()
    {
        // Set up the BindingSource component.
        this->customersBindingSource = gcnew BindingSource();
        this->companyNameTextBox = gcnew TextBox();
        this->customersBindingNavigator = gcnew BindingNavigator();
        this->customersBindingNavigator->BindingSource =
            this->customersBindingSource;
        this->customersBindingNavigator->Dock = DockStyle::Top;
        this->Controls->Add(this->customersBindingNavigator);

        // Set up the TextBox control for displaying company names.
        this->companyNameTextBox->Dock = DockStyle::Bottom;
        this->Controls->Add(this->companyNameTextBox);

        // Set up the form.
        this->Size = System::Drawing::Size(800, 200);
        this->Load += gcnew EventHandler(this, &Form1::Form1_Load);
    }

private:
    void Form1_Load(Object^ sender, EventArgs^ e)
    {
        // Open a connection to the database.
        // Replace the value of connectString with a valid
        // connection string to a Northwind database accessible
        // to your system.
        String^ connectString =
            "Integrated Security=SSPI;Persist Security Info=False;" +
            "Initial Catalog=Northwind;Data Source=localhost";
        SqlConnection^ connection = gcnew SqlConnection();
        connection->ConnectionString = connectString;
        connection->Open();

        // Execute the query.
        SqlCommand^ command = gcnew SqlCommand(
            "Select * From Customers", connection);
        SqlDataReader^ reader = command->ExecuteReader(
            CommandBehavior::CloseConnection);

        // Load the Customers result set into the DataSet.
        DataSet^ ds = gcnew DataSet("Northwind Customers");
        ds->Load(reader, LoadOption::OverwriteChanges,
            gcnew array<String^> {"Customers"});

        // Assign the DataSet as the DataSource for the
        // BindingSource.
        this->customersBindingSource->DataSource = ds->Tables[0];

        // Bind the CompanyName field to the TextBox control.
        this->companyNameTextBox->DataBindings->Add(gcnew Binding("Text",
            this->customersBindingSource, "CompanyName", true));
    }
};

http://msdn.microsoft.com/ja-jp/library/s4b01sz7%28VS.80%29.aspx

Visual C++.NET + MySQL

  • 2010-05-08 (Sat)
  • C++

Visual C++ .NET 2008 で,MySQLを扱いたい.

DataSet, BindingSource, BindingNavigator, DataTable, DataSetが何なのかわからなーい

ぐぐってたらいいサイトあったでーす★

http://itpro.nikkeibp.co.jp/article/COLUMN/20070320/265659/?ST=develop&P=1

Home

Search
Feeds
Meta

Return to page top