码迷,mamicode.com
首页 >  
搜索关键字:reverse    ( 5099个结果
noip2011普及组——数字反转
数字反转时间限制:1s 内存限制:128MB【问题描述】给定一个整数,请将该数各个位上数字反转得到一个新数。新数也应满足整数的常见形式,即除非给定的原数为零,否则反转后得到的新数的最高位数字不应为零(参见样例 2)。【输入】输入文件名为 reverse.in。输入共 1 行,一个整数 N。【输出】....
分类:其他好文   时间:2014-10-24 20:24:49    阅读次数:790
逆转单向链表
逆转单向链表#include<stdio.h> #include<stdlib.h> structNode{ intdata; structNode*next; }; voidlist_reverse(structNode**head) { structNode*cur,*rev; structNode*hold; cur=*head; rev=0; while(cur){ hold=cur; cur=cur->next; hold->..
分类:其他好文   时间:2014-10-24 19:10:08    阅读次数:208
逆转字符串
逆转字符串#include<stdio.h> #include<string.h> char*reverse(char*str) { inti,j; for(i=0,j=strlen(str)-1;i<j;++i,--j){ chartmp=str[i]; str[i]=str[j]; str[j]=tmp; } returnstr; } intmain() { charstr[100]; scanf("%s",str); reverse(..
分类:其他好文   时间:2014-10-24 16:50:08    阅读次数:177
大整数字符串相加
#include<stdio.h> #include<string.h> char*reverse(char*str) { inti,j; for(i=0,j=strlen(str)-1;i<j;++i,--j){ chartmp=str[i]; str[i]=str[j]; str[j]=tmp; } returnstr; } char*strsum(constchar*add1,constchar*add2,char*result) { inti,j,k; intca..
分类:其他好文   时间:2014-10-24 16:48:48    阅读次数:179
LeetCode:Reverse Integer
题目描述: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 思路:先判断给的数是正数还是负数还是零。如果是零,则直接返回。如果是正数,则通过%和/运算求得给定数字的各位,再重新组合得到要求得数字。如果为负数则先转换为正数,再按正数处理,最后返回...
分类:其他好文   时间:2014-10-24 16:42:21    阅读次数:112
Reverse Linked List II
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:其他好文   时间:2014-10-24 14:33:58    阅读次数:154
Python中sort以及sorted函数初探
sorted(...) Help on built-in function sorted in module __builtin__: sorted(...)     sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list sort(...) Help on built-in function sor...
分类:编程语言   时间:2014-10-24 13:03:18    阅读次数:202
Reverse Words in a String | LeetCode OJ | C++
我的思路:先读取每一个单词,存放到容器中;读取完毕后,将容器中的单词倒序写入输出中。#include#include#includeusing namespace std;void f(string &s){ vector vs; string temp=""; int i=0;...
分类:编程语言   时间:2014-10-24 12:19:25    阅读次数:165
Python_week5_lists
listlist.reverse()list.sort()list.index(obj):objis theobject to be find out; itreturns index of the found object otherwise raise an exception indicati...
分类:编程语言   时间:2014-10-24 01:41:57    阅读次数:199
链表逆转的多种实现
链表逆转的多种实现 链表的逆转是一种常见又较复杂的操作,下面使用多种方式进行实现:while、递归以及goto。...
分类:其他好文   时间:2014-10-24 00:25:56    阅读次数:169
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!