自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (2)
  • 收藏
  • 关注

转载 ZOJ分类

ZOJ分类初学者题:1001 1037 1045 1048 1049 1051 1067 1089 1109 1110 1115 1151 1195 1201 1205 1216 1240 1241 1242 1251 1292 1295 1331 1334 1337 1338 1350 1365 1382 1383 1394 1402 1405 1414 1494 1514 1622

2012-10-28 17:50:55 972

原创 POJ 1068

#include int main(){    int t = 0;    scanf("%d", &t);    while (t--)    {        int n = 0;        scanf("%d", &n);        int nLast = 0;        char aParens[40];        i

2013-12-06 12:47:23 593

原创 POJ 2632

#include #include typedef struct {    int nX;    int nY;    char cDir;}Robot_S; int main(){    int K;    Robot_S astRobots[100 + 1];    int anMap[100 + 1][100 + 1];

2013-04-01 00:46:26 919

原创 ZOJ 1205 Martian Addition

简单的大数加法#include #include #include #include using namespace std;int convertCharToInt(char c){ if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'a' && c

2012-11-10 08:23:36 377

原创 ZOJ 1201 Inversion

简单的数学题,还是挺好玩的#include int main(){ int N; while (scanf("%d", &N), N > 0) { getchar(); char type = getchar(); int num[50]; for (int i

2012-11-01 08:36:46 427

原创 ZOJ 1151 Word Reversal

典型的字符串处理。。#include #include using namespace std;int main(){ int N; cin >> N; cin.get(); for (int i = 0; i < N; i++) { string tempStr; getline(cin,

2012-10-31 09:34:01 534

原创 ZOJ 1115 Digital Roots

典型大数加法题#include #include #include #include using namespace std;int main(){ string num; while (cin >> num, num[0] != '0') { while (num.length() > 1) {

2012-10-31 08:26:07 551

原创 ZOJ 1073 Round and Round We Go

典型的字符串处理题#include #include #include #include using namespace std;int product(char num1[], int num2, char result[]){ string number(num1); int n = strlen(num1); reverse(number

2012-10-31 00:28:48 448

原创 ZOJ 1109 Language of FatMouse

这题靠STL的map可以轻松解决。只要注意用字符串作为map的键时不能是char *,因为在调用比如find比较键值时,就是对两个char *指针值的比较,而不是想要的字符串值的比较了。#include #include #include #include #include using namespace std;int main(){ map diction

2012-10-31 00:26:30 580

原创 ZOJ 1110 Dick and Jane

最近回溯写多了,这题其实可以两层循环枚举搞定的,但不自觉的就写成递归式了。。#include int s, p, y, j;bool dfs(int off[], int index){ if (index == 3) { int ss = s + off[0]; int pp = p + off[1]; int

2012-10-31 00:22:07 869

原创 ZOJ 1089 Lotto

典型的回溯,有点饥不择食了#include #include void dfs(int num[], int n, int index, int cnt, bool mark[]){ if (cnt == 6) { bool bFirst = true; for (int i = 0; i < n; i++) {

2012-10-28 16:40:22 458

原创 ZOJ 1037 Gridland

开始没细想,就直接暴搜,当然就TLE了。后来还想是DP,但会MLE。没办法看了别人的解法,原来是找规律题。。囧了规律就是:m行n列,如果m或者n是偶数(或同时都是偶数),则一定有m*n个1的解法。否则,m和n都是奇数,则最短解法为(m*n-1)个1加1.41#include int main(){ int nCase = 0; scanf("%d", &

2012-10-28 10:27:19 390

原创 ZOJ 1002 Fire Net

经典的回溯题。一次AC。#include #define BLOCKHOUSE 'b'void test(char cell, bool &bHasWall, bool &bValidToPutBlock){ if (cell == 'X') { bHasWall = true; } else if (cell == BL

2012-10-27 11:21:13 437

原创 ZOJ 1147 Formatting Text

又是一题经典的DP,很多小细节要注意,不然就WA了#include #include #include #include using namespace std;int main(){ int width = 0; while (scanf("%d", &width) && width > 0) { getchar();

2012-10-27 00:24:36 932

原创 ZOJ 1074 To the Max

最长连续子串和的扩展到二维的情况,同理可以扩展到更多维的情况。#include #include int main(){ int N = 0; scanf("%d", &N); int rect[100][100] = {0}; for (int i = 0; i < N * N; i++) { scanf("%d"

2012-10-26 07:50:06 441

原创 ZOJ 1027 Human Gene Functions

典型的DP,跟《算法导论》的最长公共子串很像。第一次有点粗心,两次次提交后AC。#include #define SPACE '-'int GetTableIndex(char c){ switch(c) { case 'A': return 0; case 'C':

2012-10-25 10:47:57 396

原创 ZOJ 1013 Great Equipment

开始看以为是背包,想了好久,没办法,看了别人的解法才知道不是背包。。最后就是输出的“Case:”,冒号后面竟然还要有个空格,题目也没说,发现ACM的题好多都这样,弄得WA,唉~~#include #include #include using namespace std;#define ITEM_CNT 3#define MAX_AMOUNT 500i

2012-10-25 10:44:48 1043

原创 ZOJ 1940 Dungeon Master

三维迷宫问题,就是BFS.简单测试后,结果都没有问题,但提交却WA.反复检查,原来是因为输出漏了一个句号!!!囧.... #include #include using namespace std;typedef struct _cube{ bool bIsCube; int x; int y; int z; _cube(bool

2011-04-05 15:30:00 605

原创 ZOJ 1710 The Snail

这是条简单题,调试中遇到的问题是变量应该用float或double,因为fatigue下降的距离会是小数。 代码:#include using namespace std;int main(int argc, char *argv[]){ double fHeightOfWell, fUpDistance, fDownDistance, fFatigueFactor;

2011-03-14 00:21:00 576

原创 ZOJ 1072 Microprocessor Simulation

也是条简单题,不过题目让我们模拟CPU挺有意思。出现过的问题:要注意地址都是十六进制表示的,即命令(010),表示的地址(10)是十六进制,也就是指十进制的16。刚开始就是这个地方搞错了,看不懂意思。。。。  #include    "iostream"using namespace std;int nMemory[256];int A, B;int E

2011-03-13 17:39:00 582

原创 ZOJ 1208 roll the die

这题目的难点在于怎么由top和front判定原始die的各面的点数。解决的方法还是要预设好所有情况,然后去匹配。 #include #include using namespace std;int DetermineRight(int top, int front){ // table recording the possible states of a die

2011-03-13 17:38:00 694

转载 【转载】网络协议学习方法和工具

<br />1.学习方法(转自http://blog.chinaunix.net/u1/33167/showart_463501.html)<br />上班了要在Linux做一些底层的网络处理,不得不从头来学Linux和网络,编程部分主要看Richard Stevens的那几本书:APUE、UNP、TCP/IP Illustraion等,学Linux则看得很杂,市面上各种Linux入门书大都翻了一遍,俺是习惯在书店里看书,爱看书而不爱买书,汗,,然后就是去各大BBS、论坛把他们的精华区都下载

2010-12-22 14:28:00 1216

转载 【转载】Socket编程指南及示例程序

原文地址:http://www.blogjava.net/wxb_nudt/archive/2007/11/01/157623.html例子代码就在我的博客中,包括六个UDP和TCP发送接受的cpp文件,一个基于MFC的局域网聊天小工具工程,和此小工具的所有运行时库、资源和执行程序。代码的压缩包位置是http://www.blogjava.net/Files/wxb_nudt/socket_src.rar。1         前言在一些常用的编程技术中,Socket网络编程可以说是最简单的一

2010-12-22 14:17:00 505

原创 杂感

<br />今日开会让我晚上思考了很多,胡思乱想出很多想法,先记录下来,顺便也活跃一下我的blog。<br />1、抛弃“无所谓”的态度。对每件事都抱着“无所谓”的态度,让人看不见细节,丧失了思辨的能力和进步的机会。看见生活中的细节,你“无所谓”,那可能你就错失了发现一个新idea的机会;今天懒床,你“无所谓”,根据“破窗定理”,那久而久之就会沉沦;撒个谎请假,你“无所谓”,那你就会习以为常,慢慢降低自己对诚信的要求,到被人揭发,就没人会相信你,你也就身败名。。。。。。我指的“无所谓”的态度并不等同于经过深

2010-11-08 00:56:00 297

原创 ZJU 1016 Parencodings

ZOJ Problem Set - 1016ParencodingsTime Limit:1 Second     Memory Limit: 32768KB Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can beencoded in two different ways:

2010-10-15 18:26:00 591

offsetDemo

一个等距轮廓填充的演示程序,里面已有图形样本

2011-03-25

USB转串口RS232驱动

USB转串口RS232驱动,对调试串口非常有用

2010-12-30

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除