//回文数判断
//首先复数一定不是回文数,若最后一位是0则一定也不是(除了0)
//可以考虑折半对比
//若为偶数
// 当ret < n 的时候,ret = n%10,ret = ret*10 + ret;
//则比较ret是否等于n
//若为奇数
//只需要在最后比较时ret/10在与n比较
//bool isPalindrome(int x) {
// int round1 = 0;
// int round2 = 0;
// if (x < 0 || x % 10 == 0 && x != 0)
// {
// return false;
// }
// else
// {
// while (round2 < x)
// {
// round1 = x % 10;
// round2 = round2 * 10 + round1;
// x = x / 10;
// }
// if (round2 == x)
// {
// return true;
// }
// else
// {
// if (round2 / 10 == x)
// {
// return true;
// }
// else
// {
// return false;
// }
// }
// }
//}
//malloc函数
//malloc时动态内存分配函数,用于申请一块连续的指定大小的内存块区域以void*类型返回分配的内存区域地址
// 关于malloc所开辟空间类型:malloc只开辟空间,不进行类型检查,只是在使用的时候进行类型的强转。
//举个例子:‘我’开辟你所需要大小的字节大小空间,至于怎么使用是你的事
//mallo函数返回的实际是一个无类型指针,必须在其前面加上指针类型强制转换才可以使用
//指针自身 = (指针类型 * )malloc(sizeof(指针类型) * 数据数量)
// ————————————————
//
// 版权声明:本文为博主原创文章,遵循 CC 4.0 BY - SA 版权协议,转载请附上原文出处链接和本声明。
//
// 原文链接:https ://blog.youkuaiyun.com/qq_42565910/article/details/90346236
//头文件#include<malloc.h>
// int *p = NULL;
//int n = 10;
//p = (int*)malloc(sizeof(int) * n);
//free函数
//作用:释放malloc(或calloc、realloc)函数给指针变量分配的内存空间。
//注意:使用后该指针变量一定要重新指向NULL,防止悬空指针(失效指针)出现,有效规避错误操作。
//int main()
//{
// int* p = (int*)malloc(sizeof(int));
// *p = 100;
// free(p);
// p = NULL;
// return 0;
// 两个数相加
// 输入:nums = [2,7,11,15], target = 9
//输出:[0, 1]
//解释:因为 nums[0] + nums[1] == 9 ,返回[0, 1]
// /**
//* Note: The returned array must be malloced, assume caller calls free().
//* /
//int* twoSum(int* nums, int numsSize, int target, int* returnSize) {
// for (int i = 0; i < numsSize - 1; i++)
// {
// for (int j = i + 1; j < numsSize; j++)
// {
// if (nums[i] + nums[j] == target)
// {
// int* ret = malloc(sizeof(int) * 2);
// ret[0] = i, ret[1] = j;
// *returnSize = 2;
// return ret;
// }
// }
// }
// *returnSize = 0;
// return NULL;
//}
//罗马数字转为整数
//暴力if else 解法
//int romanToInt(char* s) {
// int num = 0;
// int i = 0;
// while (*(s + i) != '\0')
// {
// if (*(s + i) == 'C' && *(s + i + 1) == 'D')
// {
// num = num + 400;
// i += 2;
// }
// else if (*(s + i) == 'X' && *(s + i + 1) == 'L')
// {
// num += 40;
// i += 2;
// }
// else if (*(s + i) == 'C' && *(s + i + 1) == 'M')
// {
// num += 900;
// i += 2;
// }
// else if (*(s + i) == 'I' && *(s + i + 1) == 'V')
// {
// num = num + 4;
// i += 2;
// }
// else if (*(s + i) == 'I' && *(s + i + 1) == 'X')
// {
// num += 9;
// i += 2;
// }
// else if (*(s + i) == 'X' && *(s + i + 1) == 'C')
// {
// num += 90;
// i += 2;
// }
// else if (*(s + i) == 'I')
// {
// num = num + 1;
// i++;
// }
// else if (*(s + i) == 'V')
// {
// num = num + 5;
// i++;
// }
// else if (*(s + i) == 'X')
// {
// num = num + 10;
// i++;
// }
// else if (*(s + i) == 'L')
// {
// num += 50;
// i++;
// }
// else if (*(s + i) == 'C')
// {
// num = num + 100;
// i++;
// }
// else if (*(s + i) == 'D')
// {
// num = num + 500;
// i++;
// }
// else if (*(s + i) == 'M')
// {
// num = num + 1000;
// i++;
// }
//
// }
// return num;
//}