在定义FILE * fp 之后,fopen的用法是: fp=
fopen(filename,"w")。而对于fopen_s来说,还得定义另外一个变量errno_t err,然后err =
fopen_s(&fp,filename,"w")。返回值的话,对于fopen来说,打开文件成功的话返回文件指针...
分类:
其他好文 时间:
2014-06-16 08:37:00
阅读次数:
216
Reverse Integer反转一个整数C++ Code1234567891011121314151617181920212223242526272829303132classSolution{public:intreverse(intx){/*一位数的情况*/if(-10=10){div*=10...
分类:
其他好文 时间:
2014-06-15 20:19:20
阅读次数:
196
【题目描述】因为151既是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 是回文质数。写一个程序来找出范围[a,b](5 2 #include 3 #include 4 #include 5 #include 6 #include 7 const int Max=1...
分类:
其他好文 时间:
2014-06-14 13:37:40
阅读次数:
146
void LP(const string &str, int **c){ int m =
str.size(); for(int i=0; i<m; ++i) c[i][i] = 1; for(int d=1; d<m; ++d) {
// 自底向上 ...
分类:
其他好文 时间:
2014-06-13 17:32:10
阅读次数:
234
Given an array of strings, return all groups of
strings that are anagrams.Note: All inputs will be in lower-case.题解:
判断字符串是否为回文构词法生成的。找出所有由同一回文构词法生成的字...
分类:
其他好文 时间:
2014-06-12 13:51:32
阅读次数:
200
基于上面一篇博文的代码设计求的某个数的回文距离,所谓回文距离就是给定一个数,求这个数离与他最近的那个回文数的距离,例如123的回文距离为2,因为离123最近的回文数为121,所以123的回文距离为2,代码如下:
#include
#include
#include
using namespace std;
bool fun(int);
void main()
{
int val,val...
分类:
其他好文 时间:
2014-06-11 06:43:53
阅读次数:
234
【题目描述】回文数是指从左向右念和从右向左念都一样的数。如12321就是一个典型的回文数。给定一个进制B(2 2 #include 3 #include 4
#include 5 #include 6 const int maxl=1000; 7 using namespace std; 8...
分类:
其他好文 时间:
2014-06-10 08:49:27
阅读次数:
180
戳我去解题Given an array of strings, return all
groups of strings that are anagrams.Note: All inputs will be in
lower-case.Anagram(回文构词法)是指打乱字母顺序从而得到新的单词回文...
分类:
其他好文 时间:
2014-06-10 08:44:13
阅读次数:
275