![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C学习
文章平均质量分 52
码喽啰
这个作者很懒,什么都没留下…
展开
-
指针 段溢出 段错误的自我学习
先说最近在OJ时,遇到的一个指针的的问题:int a;int *t; *t=a;可能出现错误,及其原因。 t是一个指向整型的指针,因此*t是一个整数。当a赋值给*t有什么不妥?表面看起来没什么问题,更或者运行时,时而正确时而错误。原因是因为t是一个变量(指针也是个变量),所以赋值之前是不能确定的,也就是说在赋值前不知道t指向了哪里。或许指向了一块可以赋值的地方,那运行原创 2014-03-19 12:45:46 · 3029 阅读 · 0 评论 -
Exam 1 Character Recognition - Works Application 16
Character RecognitionDescription Character recognition is the conversion of images into text. For now we consider each character in the picture is a N*M matrix with only zeros and ones, and we原创 2016-06-08 20:34:56 · 4089 阅读 · 3 评论 -
LeetCode 66. Plus One
Plus OneDes Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list.分析 本题的意思原创 2016-06-03 16:01:33 · 607 阅读 · 0 评论 -
LeetCode 198. House Robber
Remove ElementDes Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with c原创 2016-06-03 15:19:11 · 274 阅读 · 0 评论 -
LeetCode 27. Remove Elemen
Remove ElemenDes Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with co原创 2016-06-03 15:51:19 · 446 阅读 · 0 评论 -
LeetCode 345. Reverse Vowels of a String
Reverse Vowels of a StringDes Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = “hello”, return “holle”. Example 2: Given s = “le原创 2016-06-03 14:50:16 · 530 阅读 · 0 评论 -
单词统计
单词统计Des 给一个比较长的字符串,统计一共有多少个单词,并输出最短和最长的单词Code#include <iostream>#include <vector>#include <map>#include <sstream>using namespace std;int main() { string str1="Airmail, or standard mail?";原创 2016-06-02 22:00:13 · 702 阅读 · 0 评论 -
NYOJ - 599 奋斗的小蜗牛
原题链接NYOJ - 599 奋斗的小蜗牛描述 传说中能站在金字塔顶的只有两种动物,一种是鹰,一种是蜗牛。一只小蜗牛听了这个传说后,大受鼓舞,立志要爬上金字塔。为了实现自己的梦想,蜗牛找到了老鹰,老鹰告诉它金字塔高H米,小蜗牛知道一个白天自己能向上爬10米,但由于晚上要休息,自己会下滑5米。它想知道自己在第几天能站在金字塔顶,它想让你帮他写个程序帮助它。分析 注意再最后10米的时候蜗牛就一原创 2016-05-02 17:30:34 · 1266 阅读 · 0 评论 -
NYOJ - 733 万圣节派对
NYOJ - 733 万圣节派对描述 万圣节有一个Party,XadillaX显然也要去凑热闹了。因为去凑热闹的人数非常庞大,几十W的数量级吧,自然要进场就需要有门票了。很幸运的,XadillaX竟然拿到了一张真·门票!这真·门票的排列规则有些奇怪: 门票号是由0~6组成的六位数(0~6这几个数字可重用) 每一个门票号的每一位不能有三个连续相同的数字(如123335是不行的)原创 2016-05-02 17:22:53 · 571 阅读 · 0 评论 -
NYOJ - 24 素数距离问题
NYOJ - 24:素数距离问题描述 现在给出你一些数,要求你写出一个程序,输出这些整数相邻最近的素数,并输出其相距长度。如果左右有等距离长度素数,则输出左侧的值及相应距离。 如果输入的整数本身就是素数,则输出该素数本身,距离输出0Code#include<iostream>using namespace std;#素数打表,这是这个题的关键所在const int N = 1000原创 2016-05-02 13:17:55 · 502 阅读 · 0 评论 -
因子分解相关 整理
输入90,打印出90=2*3*3*5。#include #include #include main(){ int n,i,j,k; scanf("%d",&n); printf("%d=",n); i=0; while(n!=i) { for(i=2;i<n;i++) { if(n%i==0) { printf("%d*",i);原创 2014-03-30 16:39:27 · 803 阅读 · 0 评论 -
Exam 2 Maximum Xor with Prefix and Suffix - Works Application 16
Maximum Xor with Prefix and SuffixDescription We have N numbers as an array, you need to find a prefix array and a suffix arrar,which we can get the maximum xor value with all elements in them原创 2016-06-06 20:57:38 · 4939 阅读 · 2 评论