摘要: #include <bits/stdc++.h>#define ll long longusing namespace std;int main(){ int a; scanf("%d",&a); set<int> s; for(int i=1;i<=a;i++) { s.insert(i/2+i/ 阅读全文
posted @ 2019-03-02 09:58 Tonyyy 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; void print(double a,int b) { if(a>b){ cout=10;i--) { b = i%10*10+i/10; c = abs(i-b)*1.0/x; if(b == c*y){ cout<<i; ... 阅读全文
posted @ 2019-03-02 09:53 Tonyyy 阅读(127) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int main() { int n; cin>>n; vector v(n+1);//可以自定义vector长度 for(int i=1;i>v[i]; for(int i=1;i lie; vector a(n+1,1); a[i] = a[j... 阅读全文
posted @ 2019-03-02 09:31 Tonyyy 阅读(437) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int main() { int m,n,t1,t2; scanf("%d %d",&m,&n); map > mp; for(int i=0;i v(k); for(int i=0;i<k;i++) { scanf("%d",&v[i]); ... 阅读全文
posted @ 2019-03-02 09:07 Tonyyy 阅读(293) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; #define ll long long int long1(int k) { int i=0,ans=1; while(k){ k/=10; i++; } for(int j=0;j>k; l = long1(k); for(int i=... 阅读全文
posted @ 2019-03-01 11:52 Tonyyy 阅读(241) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; #define ll long long bool cmp(int a,int b){ return a>b; } int main() { int m,n; scanf("%d %d",&m,&n); int a[m+1]={0}; int b[m+1]={0}; for(int i=... 阅读全文
posted @ 2019-03-01 11:45 Tonyyy 阅读(366) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; #define ll long long int main() { string s1,s2; int sign[200]={0}; getline(cin,s1); getline(cin,s2); string s3 = s1+s2; for(int i=0;i<s3.length... 阅读全文
posted @ 2019-03-01 11:36 Tonyyy 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; #define ll long long ll stream2(string i) { ll num; stringstream stream(i); stream>>num; return num; }//字符串转数字 bool isprime(ll a) { for(ll i=2;i*i<a... 阅读全文
posted @ 2019-03-01 11:26 Tonyyy 阅读(496) 评论(0) 推荐(0) 编辑
摘要: 在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。 母函数———把组合问题的加法法则和幂级数的的乘幂的相加对应起来 我们从经典的砝码的例子讲起 题目:有1g 2g 3g 阅读全文
posted @ 2019-02-26 22:55 Tonyyy 阅读(3763) 评论(0) 推荐(0) 编辑
摘要: 首先输入一个数字代表有n个样例 接下来的三行 第一行输入n 和 v,代表n块骨头,背包体积容量为v。 第二行输入n块骨头的价值 第三行输入n块骨头的体积 问可获得最大的价值为多少 核心:关键在于dp【j】=max(dp[j],dp[j-w[i]]+v[i]) 的状态转移!! 背包最多能装下题目中所给 阅读全文
posted @ 2019-02-26 13:12 Tonyyy 阅读(142) 评论(0) 推荐(0) 编辑