1 /************************************** * *********************************** 2> File Name: d. CPP 3> author: stomach_ache 4> mail: [email protected] 5> created time: Friday, January 1, October 17, 2014 21 s 6> propose: 7 *************************************** * *******************************/8 # include <cmath> 9 # include <string> 10 # include <cstdio> 11 # include <fstream> 12 # include <cstring> 13 # include <Iost Ream> 14 # include <algorithm> 15 using namespace STD; 16/* Let's fight !!! */17 18 const int mod = 1e9 + 7; 19 const int max_n = 200050; 20 int DP [max_n]; 21 22 int main (void) {23 ios_base :: sync_with_stdio (false); 24 int R, G; 25 CIN> r> G; 26 int H = 1; 27 while (H * (H + 1) /2 <= R + G) h ++; 28 h --; 29 30 memset (DP, 0, sizeof (DP); 31 DP [0] = 1; 32 For (INT I = 1; I <= H; I ++) {33 for (Int J = r; j> = I; j --) {34 DP [J] = (DP [J] + dp [J-I]) % MOD; 35} 36} 37 h = H * (H + 1)/2; 38 int res = 0; 39 for (INT I = 0; I <= r; I ++) if (I + G> = H) res = (RES + dp [I]) % MOD; 40 cout <res <Endl; 41 42 return 0; 43}
Codeforces # round273 (div2) d