Im_hear

导航

2012年5月10日

zoj 1623

摘要: 题意是找出c++代码中的注释并将其小写改大写,输出注释个数及处理后的代码。解法,1.先找到第一个'/',如果没有,结束;2.如果下一位为'*',查找是否有对应的"*/",有则改之;3.如果下一位是'/',改到该行结束;4.重复步骤1、2、3。跟现实中的注释用法相同,用的查找字符的方法,像是c语言,位操作;如果查找字符串的,代码更简约。source code 阅读全文

posted @ 2012-05-10 22:42 Im_hear 阅读(121) 评论(0) 推荐(0) 编辑

zoj 1623

摘要: View Code 1 #include <iostream> 2 #include <fstream> 3 using namespace std; 4 #include <string> 5 #include <string.h> 6 7 int main() 8 { 9 /*ifstream cin("1.txt");//*/10 /*ofstream cout("2.txt");//*/11 int cas; 12 cin>>cas; 13 char ch[10000];14 while 阅读全文

posted @ 2012-05-10 22:29 Im_hear 阅读(232) 评论(0) 推荐(0) 编辑

zoj 1024

摘要: 开始用dfs收索,只要有一个输的策略就判输,其实题意更像这样,就像两个人从1连续数到30,先到30的人胜利,每人每次只能数1、2个数,第一个人先数,有必胜的把握吗?然后DP填表之,后来有人发现是规律题,表情略。source code 阅读全文

posted @ 2012-05-10 09:13 Im_hear 阅读(104) 评论(0) 推荐(0) 编辑

zoj 1024

摘要: 规律题-------------------DP 1 #include <iostream> 2 #include <fstream> 3 using namespace std; 4 5 int c = 0;// 6 int isleap; 7 const int cal[2][15]={ 8 {0,31,28,31,30,31,30,31,31,30,31,30,31}, 9 {0,31,29,31,30,31,30,31,31,30,31,30,31}//leap year10 };11 bool calendar[2002][13][32] = {0};//.. 阅读全文

posted @ 2012-05-10 08:47 Im_hear 阅读(191) 评论(0) 推荐(0) 编辑