The brain hole is too big. Simple things are complicated and deserve div2;
A: water, basic judgment a [I] <= A [I-1], ANS ++;
B: I don't know how others do it. My number is 100 * n. I can't think too much. I forget that it is a continuous series.
We can enumerate the tolerances and find the number of tolerances.
C: I think of map, but I am too confused to write it in just a few minutes ..
But it is not necessarily written ..
It feels good to come in to DP ..
We can find that the product is actually less ..
Then, just like adding an ordinary array.
1 # include <cstdlib> 2 # include <cctype> 3 # include <cstring> 4 # include <cstdio> 5 # include <cmath> 6 # include <algorithm> 7 # include <vector> 8 # include <string> 9 # include <iostream> 10 # include <sstream> 11 # include <map> 12 # include <set> 13 # include <queue> 14 # include <stack> 15 # include <fstream> 16 # include <numeric> 17 # include <iomanip> 18 # include <bitset> 19 # include <list> 20 # include <stdexcept> 21 # include <functional> 22 # include <utility> 23 # include <ctime> 24 using namespace STD; 25 26 # define Pb push_back27 # define MP make_pair28 29 # define rep (I, n) for (I = 0; I <(n); ++ I) 30 # define for (I, L, H) for (I = (l); I <= (h); ++ I) 31 # define Ford (I, H, l) for (I = (h); I >= (l); -- I) 32 33 typedef vector <int> VI; 34 typedef vector <string>; 35 typedef vector <double> VD; 36 typedef long ll; 37 typedef pair <int, int> PII; 38 # define mod 100000000739 40 41 Map <LL, ll> A [111]; 42 class goodsubset43 {44 public: 45 int numberofsubsets (INT goodvalue, vector <int> D) 46 {47 int n = D. size (); 48 ll ret = 0; 49 for (INT I = 0; I <n; I ++) 50 {51 for (Int J = 0; j <I; j ++) 52 {53 for (Map <LL, ll >:: iterator it = A [J]. begin (); it! = A [J]. end (); It ++) 54 {55 ll now = it-> first; 56 int H = it-> second; 57 if (goodvalue % Now = 0) 58 {59 A [I] [now * d [I] + = H; 60 a [I] [now * d [I] % = MOD; 61} 62} 63} 64 A [I] [d [I] ++; 65 A [I] [d [I] % = MOD; 66 RET + = A [I] [goodvalue]; 67 RET % = MOD; 68} 69 return ret; 70} 71}; 72 73 int main () // 74 {75 int n, m; 76 CIN> N> m; 77 vector <int> P; 78 for (INT I = 0; I <m; I ++) 79 {80 int X; 81 CIN> X; 82 p. push_back (x); 83} 84 goodsubset X; 85 cout <X. numberofsubsets (n, p); 86 return 0; 87} 88 89 90 // The code is still well understood. 91 // powered by fileedit92 // powered by tztester 1.01 [25-feb-2003] 93 // powered by codeprocessor
Topcoder SRM 632 div2