tozangezan's diary

勝手にソースコードをコピペして利用しないでください。

2016-05-01から1ヶ月間の記事一覧

AOJ 1256: Crossing Prisms

AOJ

頑張る。 全面と側面で同じ形であることを知らなくて無駄にコードを書きすぎた。 #include<stdio.h> #include<algorithm> #include<vector> #include<math.h> using namespace std; int X[2][5]; int Y[2][5]; int L[20]; int R[20]; double EPS=1e-9; int ABS(int a){return max(a,-a);} int mai</math.h></vector></algorithm></stdio.h>…

AOJ 2686: Unfair Game

AOJ

幼稚園児でも解けるような問題だった。具体的には、 A=Bの時 山が一つでA>Bの時 山が一つでA たくさん山があり、A,B>>石の個数の時 を考えてみれば自然と答えは見えてくる。 #include<stdio.h> #include<algorithm> using namespace std; int p[110000]; int main(){ int n,a,b; </algorithm></stdio.h>…

AOJ 1360: Bringing Order to Disorder

AOJ

上手いこと探索。 半分全列挙をmap DPで早くしたらオーバーキルみたいな感じになってしまった。上手いこと探索系は苦手なのでしょうがない。 #include<stdio.h> #include<algorithm> #include<map> #include<string.h> using namespace std; char in[20]; map<int,int> dpL[8][3][71]; map<int,int> dpR[8][3][71];</int,int></int,int></string.h></map></algorithm></stdio.h>…

AOJ 2688: Card Game Strategy

AOJ

AOJに戻ってみた。知識ゲーだと思って解説読みましょう。こんなDPは他に見たことがない。 実装はそこまできつくない。 #include<stdio.h> #include<algorithm> #include<vector> using namespace std; int p[610]; short dp[2][610][180010]; short rev[2][610][180010]; int dist[180100</vector></algorithm></stdio.h>…