当前位置: 首页 > news >正文

白银做网站网页设计网站首页代码

白银做网站,网页设计网站首页代码,营销网站开发isuos,机械设备上海网站建设第一个是测试用例代码#xff0c;测试的是两个带头的逆序链表相加#xff0c;并且有反转操作 但是题目要求的是不带头链表直接相加#xff0c;不需要逆转#xff0c;输出结果也是逆序的#xff0c; 题解放在第二个代码中 #includestdio.h #includestdlib.h…第一个是测试用例代码测试的是两个带头的逆序链表相加并且有反转操作 但是题目要求的是不带头链表直接相加不需要逆转输出结果也是逆序的 题解放在第二个代码中 #includestdio.h #includestdlib.h typedef struct ListNode {int val;struct ListNode* next; }List;List* reverse(List* L) {List* p L;List* q NULL;while (p ! NULL) {List* temp p-next;p-next q;q p;p temp;}List* head (List*)(malloc)(sizeof(List));head-next q;List* temp head;while (temp-next-next ! NULL) {temp temp-next;}temp-next NULL;return head; } struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {List*L1reverse(l1);L1-val 0;List*L2reverse(l2);L2-val 0;List* L3 (List*)(malloc)(sizeof(List));L3-next NULL;L3-val 0;int flag 0;while (L1 ! NULL || L2 ! NULL) {List* temp (List*)(malloc)(sizeof(List));temp-next NULL;temp-val 0;if (L1) {temp-val L1-val;L1 L1-next;}if (L2) {temp-val L2-val;L2 L2-next;}if (flag 1) {temp-val 1;flag 0;}//进位if (temp-val 10) {temp-val temp-val % 10;flag 1;}//大于10进位List* cur L3;while (cur-next ! NULL) {cur cur-next;}cur-next temp;if (L1 NULL L2 NULL flag 1) {List* digital (List*)(malloc)(sizeof(List));digital-val 1;digital-next NULL;temp-next digital;}}L3-next-val 0;return reverse(L3-next); } List* makeList() {List* L (List*)(malloc)(sizeof(List));L-next NULL;int num;while (1) {scanf(%d, num);if (num 0) {break;}List* temp (List*)(malloc)(sizeof(List));temp-next NULL;temp-val num;List* p L;while (p-next ! NULL) {p p-next;}p-next temp;}return L; } void print_List(List* L) {L L-next; // 跳过头节点while (L ! NULL) {printf(%d , L-val);L L-next;}printf(\n); }int main() {List* L1 makeList();printf(打印L1\n);print_List(L1);List* L3reverse(L1);List* L2 makeList();printf(打印L2\n);print_List(L2);List* L4 reverse(L2);printf(打印L3\n);print_List(L3);printf(打印L4\n);print_List(L4);List* L5 addTwoNumbers(L3, L4);printf(打印L5\n);print_List(L5); } struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {struct ListNode* L3 (struct ListNode*)(malloc)(sizeof(struct ListNode));L3-next NULL;L3-val0;int flag 0;while (l1 ! NULL || l2 ! NULL) {struct ListNode* temp (struct ListNode*)(malloc)(sizeof(struct ListNode));temp-next NULL;temp-val 0;if (l1) {temp-val l1-val;l1 l1-next;}if (l2) {temp-val l2-val;l2 l2-next;}if (flag 1) {temp-val 1;flag 0;}//进位if (temp-val 10) {temp-val temp-val % 10;flag 1;}//大于10进位struct ListNode* cur L3;while (cur-next ! NULL) {cur cur-next;}cur-next temp;if (l1 NULL l2 NULL flag 1) {struct ListNode* digital (struct ListNode*)(malloc)(sizeof(struct ListNode));digital-val 1;digital-next NULL;temp-next digital;}}return (L3-next); }
http://www.hkea.cn/news/14307014/

相关文章:

  • 宿迁网站seo开通网站申请书
  • 怎么做简单网站首页网站备案信息登记表
  • 做网站推广收入好吗重庆市建设施工安全网站
  • 西安市住房和城乡建设局门户网站网站建设快速
  • 网站开发的未来展望唐山万唯网络科技有限公司
  • 长春网站开发senluowx网页游戏传奇霸业攻略
  • 竞价网站服务器郑州做网站公司
  • 怎么做网站能快速赚钱免费网站建站2773
  • 网站打赏怎么做的做网站设计难吗
  • 阿里云做网站开发吗网站怎么让百度收录
  • 网站建设步骤与时间表网站搭建前景
  • drupal 网站开发wordpress页码插件
  • wordpress外贸模板下载佛山关键词优化
  • 企业做网站的费用账务如何处理系部网站建设管理方案
  • 做网站找俊义 合优企点怎么群发消息
  • 大学生网站设计作品成品代码模板工
  • 惠州网站外包wordpress纯净版下载地址
  • 百度站长平台删站免费数据分析网站
  • 北京高端 网站建设多个微信管理系统
  • php房产中介网站源码威海微网站建设
  • 山东网站建设标准品牌营销和市场营销的区别
  • 桂林创新大厦网站故事型软文广告
  • 外贸网站租用外国服务器好还是自己装一个服务器好百度百科优化排名
  • 改进网站建设英文作文几十万做网站平台
  • 网站备案视频app是程序员做出来的吗
  • 培训网站开发学校贵阳新闻最新消息今天
  • 勾线外包网站wordpress4.8.2下载
  • 荆州北京网站建设wordpress默认字体
  • 做刀模网站安康市建设局网站
  • 成都住建厅官方网站学做网站论坛VIP怎么样