Shirlies
宁静专注认真的程序媛~
摘要: 贪心题Problem Description“Point, point, life of student!”This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course.There are 5 problems in this final exam. And I will give you 100 阅读全文
posted @ 2012-01-17 20:41 Shirlies 阅读(819) 评论(0) 推荐(0) 编辑
摘要: A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA"is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left.A mirrored string is a string for 阅读全文
posted @ 2012-01-16 23:10 Shirlies 阅读(666) 评论(0) 推荐(0) 编辑
摘要: #include "stdio.h"int main(){int count;char ch;int ok=0;while((ch=getchar())!=EOF){ok=0;count=0;while(ch!='\n'){if((ch>='A'&&ch<='Z')||(ch>='a'&&ch<='z'))ok=1;if(ok&&!((ch>='A'&&ch<='Z' 阅读全文
posted @ 2012-01-16 13:08 Shirlies 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 最近做的题目可能都会是西班牙Valladolid大学的UVaOJ上面的题目,因为最近看的是Rujia Liu先生的书,他的书上面的题目练习是这个上面的哈这是我在上面做的第一道题目,但是已经开始出现问题啦#include "stdio.h"int main(){long long n,m,t;while(scanf("%lld%lld",&n,&m)==2){if(n>m){t=n;n=m;m=t;}printf("%lld\n",m-n);}return 0;}就是这样写在Microsoft Visual C++ 阅读全文
posted @ 2012-01-15 20:10 Shirlies 阅读(577) 评论(0) 推荐(0) 编辑
摘要: 留给自己看看,我的博客,我的成长……#include "fstream"//#define fin cin//#define fout cout using namespace std;//改成标准输入输出时可以注释掉下面两行,将上面注释的两行注释符号侧掉 ifstream fin("data.in");ofstream fout("data.out");int main(){int a,b;while(fin>>a>>b)fout<<a+b<<endl;return 0;}还要注意头文 阅读全文
posted @ 2012-01-04 21:26 Shirlies 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 留给自己看看的,这个博客就是记录自己的心得与所收获的地方。//#define LOCAL#include "stdio.h"#define INF 1000000000int main(){ //以下是重定向版,用来比较方便//如果用红色部分,所有蓝色部分就不要用了//#ifdef LOCAL//freopen("1.in","r",stdin);// freopen("1.out","w",stdout);//#endif//以下是fopen版,有点麻烦,如果要改成读写标准输入输出,要将fin 阅读全文
posted @ 2012-01-04 20:32 Shirlies 阅读(575) 评论(0) 推荐(0) 编辑
摘要: 我真的很想在这里好好分析一下这一题啊,首先一看题目给人的感觉就是貌似每行如果后面都是空格就不能输出,但是貌似这样很难,我就先不试这个,看看用矩形可以不,然后我敲出来了,第一次是最后面有空格,错了,嗯嗯,空格有问题,并好好分析了一下题目,发现“shows how many times each letter (but not blanks, digits, or punctuation) appears in the all-upper-case input“,喔,是输入的字符字母的个数(即没有的不用输出打印咯),改了两方面:输出空格,输出字符;但是结果竟然是错的,但是再细细理解,没有错啊,怎么 阅读全文
posted @ 2011-12-17 20:17 Shirlies 阅读(564) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3794晕,这一题我做的很是无语,一道很水的贪心的题目,提交了好多次,起初犯得是很SB的错误,改了,之后的思路我自己认为是完全正确的,然后发现题目的数据要求到十的七次方,十的六次方,要用到__int64,好吧,我改!晕,还是WA,我真的不知道我自己哪里错了,今天睡午觉的时候,脑海里有那一题的影子,忽然醒悟,哇,t值没有被初始化,汗,该死的错误!晚上回来后就做这道题,我改,改了,还是WA,无语啦,好想求救,网上搜了一下,发现大家都是用的__int64即输入的那些值也是这种类型的,其他的思路是一样的,那么我改改试一 阅读全文
posted @ 2011-12-12 22:51 Shirlies 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1069这一题够折磨人,这一题难度在dp中只是1难度值,害惨我了,不过也学到了不少东西#include <iostream>#include "algorithm"using namespace std;struct blocks{int x,y,z;}jm[3*31];int dp[3*31];bool cmp(blocks a,blocks b)//这个sort排序要用到的东西,起初我是用指针的,汗,错死我了,我在想我到底应该怎样解决这类问题啊,找不到问题,思路又没有问 阅读全文
posted @ 2011-12-08 20:51 Shirlies 阅读(426) 评论(0) 推荐(0) 编辑
摘要: 一、实验内容【问题描述】设计一个能够对链式存储的二叉树进行层次遍历的演示程序。【基本要求】从键盘输入数据,创建一棵二叉树,然后将层次编历的结果输出。【测试数据】输入的二叉树见教材127页图6.8(b),输出为ABCDEFG。二、实验目的1.熟悉掌握二叉树和队列的基本操作。2.培养运用队列解决问题的能力。三、程序代码#include "stdio.h"#include "stdlib.h"#define MAX 1000000typedef struct Bitree{char data;struct Bitree *lchild,*rchild;}Bit 阅读全文
posted @ 2011-12-04 18:25 Shirlies 阅读(4203) 评论(0) 推荐(0) 编辑