03 2017 档案
摘要:1 #include 2 #include 3 using namespace std; 4 5 int ans; 6 char s[10005]; 7 char v[10005]; 8 9 void solve(int x) 10 { 11 if(!ans || v[ans] =s[x]) 18 { 19 v...
阅读全文
摘要:1 //认真读题啊。。。。。。。。god。。。。 2 #include 3 #include 4 using namespace std; 5 6 int ans; 7 int v[3005]; 8 9 void solve(int x) 10 { 11 int i; 12 for(i=0; i= x) 14 { 15 ...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 5 int ans; 6 int v[21]; 7 8 void solve(int x) 9 { 10 int t; 11 if(!ans || v[ans] > x) 12 v[++ans] = x; 13 else 14 { 1...
阅读全文
摘要: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 ...
阅读全文
摘要:ACM入门姿势:https://www.zhihu.com/question/51727516/answer/127265733?utm_medium=social&utm_source=qq 树状数组:http://blog.csdn.net/int64ago/article/details/74
阅读全文
摘要: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 { ...
阅读全文
摘要:数组基础:http://www.cnblogs.com/mengdd/archive/2013/01/04/2844264.html import java.util.Arrays; 1):创建数组 2):输出数组 3):从一个数组创建数组列表 4):检查一个数组是否包含某个值 5):连接两个数组
阅读全文
摘要:一、final关键字可以用来修饰类、方法、变量。各有不同。 A、修饰类(class)。 1、该类不能被继承。 2、类中的方法不会被覆盖,因此默认都是final的。 3、用途:设计类时,如果该类不需要有子类,不必要被扩展,类的实现细节不允许被改变,那么就设计成final类 B、修饰方法(method)
阅读全文
摘要: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 ...
阅读全文
摘要: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) &&...
阅读全文
摘要: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...
阅读全文
摘要: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-...
阅读全文
摘要: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 }
阅读全文