2011-06-01から1ヶ月間の記事一覧

PKU 3782-Equal Sum Partitions

PKU

問題概要 数列が与えられる。 数字数字の間に区切り線を入れて、それぞれの総和を求める。 総和が全て一致するときの、総和の最小値を求めよ。 例:1,2,3,3,2,1の場合1,2|3|3|2,1で解は3となる。 解法 求める数を仮定して解く。 計算量が怪しいけど通った。 …

PKU 3781-Nth Largest Value

PKU

問題概要 10個の数値が与えられる。3番目に大きい数を求めよ。 解法 sortして8番目に大きい数値を求めるだけ。 実装 #include <algorithm> #include <iostream> #include <vector> #define REP(i,x) for(int i=0;i<(int)(x);i++) using namespace std; int dx[4]={-1,0,1,0},dy[4]={0,-1,0</vector></iostream></algorithm>…

2010-Poor Mail Forwarding

AOJ

問題概要 略 考え方 ひたすらシュミレーション. 実装時間が3時間以上なので本番では解けてない 実装(C++) #include <cstdio> #include <cmath> #include <cstring> #include <cstdlib> #include <climits> #include <cctype> #include <ctime> #include <cassert> #include <cwchar> #include <cstdarg> #include <cwctype> #include <queue> #include <stack> #include…</stack></queue></cwctype></cstdarg></cwchar></cassert></ctime></cctype></climits></cstdlib></cstring></cmath></cstdio>

Uva195 - Anagram

UVa

UVa Online Judge 問題概要 ある文字列があたえられるので,その文字列の文字を入れかえて作れる文字列を辞書順に表示せよ. ただし,'A' 考え方 辞書順の定義を実装して,next_permutationするだけ. 実装(C++) #include <algorithm> #include <iostream> using namespace std; s</iostream></algorithm>…

6月の目標

今月から毎月目標を立てることにする. 今月は ・UVa100問解く ・AOJ40問解く ・TopCoderのレート1700以上の維持 ・ICPC国内予選での学内3位以上 を目標にすることにする.(6/13)実力不足によりUVa100問は諦めます。。。

100-The 3n + 1 problem

Uva

UVa Online Judge 問題概要 コラッツ予想のような処理をして,1に辿りつくまでの時間をf(x)とする. iとjの間にある整数およびi,j自身におけるf(x)の最大値を求めよ.