0w1

Entries from 2016-04-06 to 1 day

CFR 568 1A. Primes or Palindromes? ( Brute Force )

Problem - A - Codeforces 一開始以為有二分性質,結果原來只需要暴力。。然後我預處理的部份也寫得太複雜了,其實根本可以更暴力的搞,會很好寫的。 #include <bits/stdc++.h> using namespace std; const int MAXPQ = 1e4 + 4; const int MAXT = 6e6 + 6; typedef long lo</bits/stdc++.h>…

CFR 610 C. Harmony Analysis ( Ad hoc )

Problem - C - Codeforces 這題需要的是一點直覺,或說是靈感。要發現其實只要遞迴構造左上右上左下都相同的,而右下正負相反,初始是n = 0時為+。 #include <bits/stdc++.h> using namespace std; const int MAXK = 9 + 1; int a[ 1 << MAXK ][ 1 << MAXK ]; int main(){ i</bits/stdc++.h>…

CFR 297 1A. Parity Game ( Ad hoc )

Problem - 297A - Codeforces 顯然1的數量最多只會變多一次,而且是當且僅當原本1的數量是奇數。排除掉那些情況後觀察一下就會發現怎樣都可以使a變成b的。 #include <bits/stdc++.h> using namespace std; const int MAXS = 1e3 + 3; string a, b; int countOne( const stri</bits/stdc++.h>…

CFR 295 1C. Greg and Friends ( DP + Restoration )

Problem - C - Codeforces dp[ i ][ j ][ k ] : boat is on the original side, j people 50 pounds are on the goal, k people 100 pounds are on the goal Then we will be able to perform PFS to find the shortest path, but since all the weights for…