水+暴力+模拟+碎碎念
文章平均质量分 74
muximuxi525
有些事情暂时可以放下但是绝不能放弃
展开
-
POJ 2358
水题。但是,水的很郁闷啊,空格竟然我竟然忘了处理。因为我都是一概放进字符数组去处理了,但是空格的没有考虑。但是,在验证数据的时候有空格(出现空挡,但应该不是空格,至少不是我主动打出来的),这时候就一脚踏进坑里了。囧。program:#include#include#include#include#includeusing namespace std;char t原创 2012-08-31 21:21:18 · 927 阅读 · 0 评论 -
UVA 10815 Andy's First Dictionary
Andy's First DictionaryTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionProblem B: Andy's First DictionaryTime limi原创 2013-01-27 18:40:01 · 1152 阅读 · 0 评论 -
BNUOJ29376 沙漠之旅
沙漠之旅Time Limit: 1000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: Main Prev Submit Status Statisti原创 2013-05-04 19:45:37 · 987 阅读 · 0 评论 -
VC 测量自己的程序执行时间
#include "stdio.h"#include "stdlib.h"#include "time.h"int main( void ){ long i = 10000000L; clock_t start, finish; double duration; /* 测量一个事件持续的时间*/ printf( "Time to do %ld emp原创 2012-08-31 14:43:35 · 576 阅读 · 0 评论 -
UVA 409 Excuses, Excuses!
Excuses, Excuses! Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in order to avoid serving. In order to reduce the amount of time required原创 2013-01-27 21:40:47 · 797 阅读 · 0 评论 -
POJ 1917 Automatic Poetry
题目大意:对输入的每一对字符串进行处理:输出有两行(1)第一行不要把""的符号输出 (2)第二行用(1)上面的思路:模拟的有点恶心阿,关键是对Ac Program:#include#include#includeusing namespace std;char l1[105];char l2[105]; char c1[105],c11[105];cha原创 2013-01-25 23:16:34 · 653 阅读 · 0 评论 -
C--我对指针和引用const之后的理解
指针:(1)int * p;普通指针,散发着不一般的气质。“这个指针飘无定所,随意指向谁谁。”(2)int ta=9933;int *p=&ta;初始化指针。这个指针指向了ta。“指针开始有了较为明朗的方向,开始注意到了ta。”(3)int ta=9933;int * const p=&ta;这个指针常量化,也就是指针常量,这个指针的指向永远不改变。“这个指针准备和这个ta过上原创 2013-02-28 12:24:16 · 590 阅读 · 0 评论 -
sort qsort 小结
STL 中 sort 函数用法简介 做 ACM 题的时候,排序是一种经常要用到的操作。如果每次都自己写个冒泡之类的 O(n^2) 排序,不但程序容易超时,而且浪费宝贵的比赛时间,还很有可能写错。 STL 里面有个 sort 函数,可以直接对数组排序,复杂度为 n*log2(n) 。使用这个函数,需要包含头文件#include 。这个函数可以传两个参数或三个参数。第一个参数是要排序的区间原创 2012-08-20 19:54:40 · 545 阅读 · 0 评论 -
getchar()的用法
先是一个简单例子: #include stdio.h> #include int main(void) { int c; // int类型更安全,为什么?看下文详细解释 int a; a = getchar(); printf ("%c",a); while ((c = getchar())原创 2012-08-19 22:44:11 · 1401 阅读 · 0 评论 -
2013内部赛第一场D,F题 暨由此引发的思考
内部赛第一场D题 D Shut The Box ITheir pursuit of the Collector has taken the Avengers on a long voyage through the galaxies, and they are looking for ways原创 2013-04-21 21:29:04 · 1214 阅读 · 0 评论 -
UVA 644 Immediate Decodability
Immediate Decodability An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this pro原创 2013-01-29 21:41:21 · 839 阅读 · 0 评论 -
HDU1022 Train Problem I
题目大意:水题一枚,但是自己很水,所以模拟了蛮久.囧.栈模拟.开了三个栈oo1,oo2,oo3.oo2保存要求火车离开的顺序oo3模拟火车进站的顺序oo1是辅助栈,为了方便提取进站的头一列车.学数据结构的时候没好好写写伪代码,所以模拟的思路一开始一塌糊涂.后来认认真真的写一遍伪代码,思路清晰多了:(1)如果oo3栈不为空,并且栈顶元素和oo2栈顶元素相等的话,那么两个栈都开原创 2013-03-16 11:35:59 · 919 阅读 · 1 评论 -
F - Power of Cryptography
Power of CryptographyBackgroundCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work原创 2012-10-06 23:13:50 · 972 阅读 · 0 评论 -
继续小练sscanf----HDU 2024
题目大意&&思路:C语言合法标识符~~sscanfAC program:#include#include#includeusing namespace std;int main(){ int test; char cc[100],tmp[100]; cin>>test; getchar(); while(test--) {原创 2012-10-08 08:59:56 · 544 阅读 · 0 评论 -
POJ2105 IP Address
学了一下insert();囧。。AC program:#include#include#include#include#include#include#include#includeusing namespace std;void fn(int p , string aa){ int len=aa.length(); int sum=0,base=1; fo原创 2012-10-10 19:30:03 · 666 阅读 · 0 评论 -
ZOJ2421 Recaman's Sequence
ZOJ的水题怎么老是那么奇葩~~今天真是好好见识了ZOJ的编译器的各种奇葩~~头文件加多了竟然会RE~~囧。。以往我都是头文件一坨坨的堆的~~~简单打表:AC program:#includeusing namespace std;int pp[500100];int ff[10000100];// int main(){pp[0]=0;ff[0]=1;int tm原创 2012-10-10 18:43:13 · 904 阅读 · 0 评论 -
ZOJ1195 Blowing Fuses
这道ZOJ的水题~~~让我认识了ZOJ的Segmentation Fault。坑爹~~尼玛坑爹~~输出的过程居然不能有for循环的处理程序,只能单独隔离输入,即先要保存输入。算算了,算是ZOJ的奇葩吧~~AC program:#include#include#include#include#include#include#include#includeusing names原创 2012-10-10 17:15:08 · 1087 阅读 · 1 评论 -
POJ1004 Financial Management
题目大意&&思路:不能再水了这道题目,求平均数。但是有几点可以引申并且要注意的:printf("%.2lf");是不规范的,只是在大部分的系统可以接受,所以这道水题我WA了2次让我情何以堪啊~~~呜呜。。只有printf("%.2f");才是规范的。即可接受单精度,又可接受双精度。(1)错误的做法:int n=12;double sum=0,tmp; while(n--) {原创 2012-10-06 10:12:09 · 683 阅读 · 0 评论 -
HDU 2137 circumgyrate the string
题意:打印出旋转字符串思路:有几个trick:(1)横着打出来的要顶格(2)竖着打出来的要有空格在前面(3)打印出字符之后没有空格出现了(好久没切过题了,这样的题目老早要挂在word哪里工具--选项--显示所有的该死的东西的)(4)n为负数代码胡乱码,真心恶心,自己的代码是要好好修一下了.一维的简单更优雅.#include#include#inclu原创 2013-01-24 23:25:26 · 537 阅读 · 0 评论 -
2013编程之美全国挑战赛资格赛(Beauty of Programming) 传话游戏
时间限制: 1000ms 内存限制: 256MB描述Alice和Bob还有其他几位好朋友在一起玩传话游戏。这个游戏是这样进行的:首先,所有游戏者按顺序站成一排,Alice站第一位,Bob站最后一位。然后,Alice想一句话悄悄告诉第二位游戏者,第二位游戏者又悄悄地告诉第三位,第三位又告诉第四位……以此类推,直到倒数第二位告诉Bob。两位游戏者在传话中,不能让其他人听到,也不能使用肢体动原创 2013-04-07 22:06:28 · 944 阅读 · 0 评论 -
HDU1010 && 多校联合第一场H题
HDU1010题目大意:狗狗在指定的时间不迟不早走到终点.思路:奇偶剪枝+DFS杭电这道题的输入有点坑,scanf+getchar()矩阵输入是不一定的.有可能是在一行输入.用了cin过的.o(╯□╰)o... AC program:#include#include#includeusing namespace std; char map[10][10];int t原创 2013-03-20 10:01:42 · 865 阅读 · 0 评论 -
Pythagorean Theorem II
A.Pythagorean Theorem IItime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn mathematics, the Pythagorean th原创 2013-05-22 23:07:59 · 1195 阅读 · 0 评论