赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年4月9日

摘要: 1. 进制转换+回文判断+int与char之间相互转换;以下是代码:/* ID: dollar4 PROG: palsquare LANG: C++ */ #include #include #include #include #include using namespace std; int base; bool checkp(string str) { int len = str.size(); for (int i = 0; i > base; for (i = 1; i #include #include #include #include ... 阅读全文
posted @ 2012-04-09 19:37 赵乐ACM 阅读(154) 评论(0) 推荐(0)

摘要: 1. 比较简单,但是用到了文件读写,终于明白了给的test代码中的fout和fin是什么意思了,哈哈;2. 如果按照一般的思路,肯定会超时,所以把dict转换成数字,这样的算法效率是固定的以下是代码:/* ID: dollar4 PROG: namenum LANG: C++ */ #include #include #include #include #include using namespace std; char get_num(char a) { switch (a) { case 'A' : return '2'; cas... 阅读全文
posted @ 2012-04-09 16:44 赵乐ACM 阅读(139) 评论(0) 推荐(0)

摘要: 1. 被这道题虐了无数次,每次编译通过,但是运行会错误(当时用的是string数组), 后来把string数组改成char[][]二维数组就好了;2. 给的参考代码是不对的3. 如果函数的返回类型是数组,只能通过指针来实现,但是参考代码给了一种巧妙的方法,把数组封装成结构体,然后返回结构体以下是我的代码:/* ID: dollar4 PROG: transform LANG: C++ */ #include #include #include #include #include using namespace std; typedef char array[10][10]; cha... 阅读全文
posted @ 2012-04-09 13:59 赵乐ACM 阅读(155) 评论(0) 推荐(0)