上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 30 下一页
摘要: 1 //完全背包,可通过另一数组存重量的最大价值进行优化 2 #include 3 #define inf 1 bag[i]) 19 bag[i] = bag[i-r] + v; 20 } 21 22 int main() 23 { 24 int n,num,room,val; 25 cin >> n; 26 while(n--) 27 ... 阅读全文
posted @ 2017-03-31 12:07 Posase 阅读(148) 评论(0) 推荐(0) 编辑
摘要: ACM入门姿势:https://www.zhihu.com/question/51727516/answer/127265733?utm_medium=social&utm_source=qq 树状数组:http://blog.csdn.net/int64ago/article/details/74 阅读全文
posted @ 2017-03-26 22:18 Posase 阅读(129) 评论(1) 推荐(0) 编辑
摘要: 1 //C++STL入门,set的简单应用 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 set dict; 8 int main() 9 { 10 string s,x; 11 while(getline(cin,s) && s[0] != '#') 12 { ... 阅读全文
posted @ 2017-03-26 17:31 Posase 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 数组基础:http://www.cnblogs.com/mengdd/archive/2013/01/04/2844264.html import java.util.Arrays; 1):创建数组 2):输出数组 3):从一个数组创建数组列表 4):检查一个数组是否包含某个值 5):连接两个数组 阅读全文
posted @ 2017-03-24 10:12 Posase 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 一、final关键字可以用来修饰类、方法、变量。各有不同。 A、修饰类(class)。 1、该类不能被继承。 2、类中的方法不会被覆盖,因此默认都是final的。 3、用途:设计类时,如果该类不需要有子类,不必要被扩展,类的实现细节不允许被改变,那么就设计成final类 B、修饰方法(method) 阅读全文
posted @ 2017-03-23 21:55 Posase 阅读(3314) 评论(0) 推荐(1) 编辑
摘要: 1 //可转化为多重背包问题即可 2 #include 3 #include 4 int bag[21]; 5 6 void multiple_bag(int,int,int,int); 7 void complete_bag(int,int,int); 8 void zero_one_bag(int,int,int); 9 10 int main() 11 { 12 ... 阅读全文
posted @ 2017-03-21 13:16 Posase 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 char s[20][30]; 3 int ans[20]; 4 int n,top=0,mins=30; 5 6 void _sort(int,int,int); 7 int lenth(char*); 8 9 int main() 10 { 11 int i,Case=1; 12 while(~scanf("%d",&n) &&... 阅读全文
posted @ 2017-03-13 20:12 Posase 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 char temp[6]; 4 char ans[6]; 5 int main() 6 { 7 int n; 8 scanf("%d",&n); 9 while(n--) 10 { 11 int m; 12 scanf("%d",&m); 13 sca... 阅读全文
posted @ 2017-03-13 20:11 Posase 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int main() 3 { 4 int n; 5 long long x; 6 scanf("%d",&n); 7 while(n--) 8 { 9 scanf("%lld",&x); 10 if(x-1) 11 printf("%lld471\n",x-... 阅读全文
posted @ 2017-03-11 21:38 Posase 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int main() 3 { 4 int n; 5 while(~scanf("%d",&n)) 6 if(n<3) 7 puts("Hrdv"); 8 else 9 puts("Yougth"); 10 } 阅读全文
posted @ 2017-03-11 21:28 Posase 阅读(106) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 30 下一页