Home > Archives > 2010-06 Archive
2010-06 Archive
japan vs paraguay
- 2010/06/30 1:25 am
- Prog
i am watching fifa world cup 2010 south africa on tv
Frank De Bleeckere ‘s judge is somehow wrong… what… what…
- Comments: 0
- Trackbacks: 0
string s = “”+chでうまく代入されない
- 2010/06/20 10:47 pm
- C++
char ch='A'; string s = ""+ch; cout << s << endl;
これ実行すると,Aが出力されない.なーんでだ
- Comments: 0
- Trackbacks: 0
2005 Problem D.Traveling by Stagecoach
- 2010/06/19 10:21 am
- 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;
}
}
- Comments: 0
- Trackbacks: 0
(HHKB Pro) Happy Hacking Keyboard Professional 購入
- 2010/06/17 11:50 pm
- Prog
PFU Happy Hacking Keyboard Professional 購入しました.Pro2 ではないでーす
使用感: Delete KeyとEnterキーの位置がJISキーボードと異なるので戸惑った.
やはり高級キーボードというだけあって,スムースに打てるし,疲労を感じさせない.
- Comments: 0
- Trackbacks: 0
Yahoo!BB 速度が1/10になった
- 2010/06/05 9:06 pm
- Prog
Yahoo!BB ADSL 8Mbps を使用していますが,先週から速度が6Mbps から 0.6Mbps まで落ちました.
そこで,サポートセンターにアクセスし,
https://ybb.softbank.jp/support/inquiry/member/?mode=tech
最後の自由記述欄に,回線調整お願いします.と書いておきます.
1営業日〜2営業日後にYahoo!BBのメルアドに,回線調整した件についてメールがきます.
私は改善されなかったので,モデム交換をお願いしました.
今日モデムが到着して元通りの速度が出ています!
- Comments: 0
- Trackbacks: 0
Home > Archives > 2010-06 Archive
- Search
- Feeds
- Meta
