自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 收藏
  • 关注

原创 PAT1013 Battle Over Cities

Sample Input3 2 31 21 31 2 3Sample Output100 #include <iostream>#include <string.h>using namespace std;int map[1000][1000]={0};int copy_map[1000][1000...

2012-11-29 23:59:51 85

原创 PAT1003 Emergency

Sample Input5 6 0 21 2 1 5 30 1 10 2 20 3 11 2 12 4 13 4 1Sample Output2 4   #include <iostream>using namespace std;#define INF 1000000int Graph[500][50...

2012-11-29 23:46:47 87

原创 PAT1041 Be Unique

找出只出现过一次的数,用各种排序必然超时,需要用数组做hash表Sample Input 1:7 5 31 5 88 67 88 17Sample Output 1:31Sample Input 2:5 888 666 666 888 888Sample Output 2:None #include <stdio.h>#include <stdlib.h&g...

2012-11-23 23:43:46 99

原创 PAT1042 Shuffling Machine

扑克洗牌   #include <iostream>#include <string>#include <vector>#include <iomanip>#include <map>#include <algorithm>using namespace std;void ...

2012-11-23 23:42:33 124

原创 PAT1040 Longest Symmetric String

求最长回文子串  #include <iostream>#include <string>#include <iomanip>using namespace std;int main(){ string a; getline(cin,a); int max = 0; int len...

2012-11-23 23:41:54 69

原创 PAT1036 Boys vs Girls

Sample Input 1:3Joe M Math990112 89Mike M CS991301 100Mary F EE990830 95Sample Output 1:Mary EE990830Joe Math9901126Sample Input 2:1Jean M AA980920 60Sample Output 2:...

2012-11-23 23:41:07 119

原创 PAT1035 Password

Sample Input 1:3Team000002 Rlsp0dfaTeam000003 perfectpwdTeam000001 R1spOdfaSample Output 1:2Team000002 RLsp%dfaTeam000001 R@spodfaSample Input 2:1team110 abcdefg332Sam...

2012-11-23 23:40:29 91

原创 PAT1031 Hello World for U

Sample Input:helloworld!Sample Output:h !e dl llowor       #include <iostream>#include <iomanip>#include <string>using namespace std;...

2012-11-22 23:54:37 126

原创 PAT1029 Median

用标准库的排序全部超时,需要自己实现,另外还不能用cin cout  Sample Input4 11 12 13 145 9 10 15 16 17Sample Output13       #include <stdio.h>int N1[1000000];int N2[1000000];i...

2012-11-22 23:54:04 82

原创 PAT1028 List Sorting

用vector最后一个用例超时了。。。 Sample Input 13 1000007 James 85000010 Amy 90000001 Zoe 60Sample Output 1000001 Zoe 60000007 James 85000010 Amy 90Sample Input 24 2000007 James ...

2012-11-22 23:53:05 83

原创 PAT1027 Colors in Mars

Sample Input15 43 71Sample Output#123456     #include <iostream>#include <iomanip>#include <string>using namespace std;void convert(int a){ ...

2012-11-22 23:52:28 79

原创 PAT1025 PAT Ranking

Sample Input:251234567890001 951234567890005 1001234567890003 951234567890002 771234567890004 8541234567890013 651234567890011 251234567890014 1001234567890012 85Sample Ou...

2012-11-22 23:51:45 114

原创 PAT1023 Have Fun with Numbers

大数的相加 比较两个字符串中字符完全相同 Sample Input: 1234567899Sample Output:Yes2469135798    #include <iostream>#include <string>#include <vector>#include <io...

2012-11-21 23:55:21 86

原创 PAT1022 Digital Library

占坑。。。

2012-11-21 23:54:46 77

原创 PAT1020 Tree Traversals

已知中序遍历 后序遍历,求层次遍历 Sample Input:72 3 1 5 7 6 41 2 3 4 5 6 7Sample Output:4 1 6 3 5 7 2  #include <string.h>#include <iostream>using namespace std;#define M...

2012-11-21 23:54:13 93

原创 PAT1019 General Palindromic Number

十进制转任意进制,并比较是否是回文数 Sample Input 1:27 2Sample Output 1:Yes1 1 0 1 1Sample Input 2:121 5Sample Output 2:No4 4 1  #include <string.h>#include <iostream&...

2012-11-21 23:53:47 80

原创 PAT1037 Magic Coupon

 Sample Input:41 2 4 -147 6 -2 -3Sample Output:43   #include <iostream>#include <string.h>#include <vector>#include <algorithm>#include ...

2012-11-21 15:46:15 66

原创 PAT1038 Recover the Smallest Number

由一道面试题改的   把数组排成最小的数 不同之处是这个是直接按字符串处理的 Sample Input:5 32 321 3214 0229 87Sample Output:22932132143287 #include <iostream>#include <string>#include <sstre...

2012-11-20 23:52:17 102

原创 PAT1024 Palindromic Number

Sample Input 1:67 3Sample Output 1:4842Sample Input 2:69 3Sample Output 2:13533    #include <iostream>#include <string>#include <iomanip>...

2012-11-20 23:51:23 81

原创 PAT1015 Reversible Primes

十进制转任意进制  假设十进制数为number,转换的进制为digits,则将numbers%digits(根据余数的情况做相应处理)结果保存在字符串str中,将numbers变为numbers/digits;直到numbers为零。得到的结果为逆序,需要将其倒转,倒转后即为所求。  这里不需要倒序,直接转  Sample Input:73 10...

2012-11-19 23:51:45 96

原创 PAT1012 The Best Rank

四门功课,输出排名最高的是哪个 Sample Input5 6310101 98 85 88310102 70 95 88310103 82 87 94310104 91 91 91310105 85 90 90310101310102310103310104310105999999Sample Output1 C1 M...

2012-11-19 23:50:55 75

原创 PAT1011 World Cup Betting

Sample Input1.1 2.5 1.71.2 3.0 1.64.1 1.2 1.1Sample OutputT T W 37.98 #include <iostream>#include <iomanip>#include <string>using namespace std;int ma...

2012-11-19 23:50:31 80

原创 PAT1009 Product of Polynomials

多项式乘法 Sample Input2 1 2.4 0 3.22 2 1.5 1 0.5Sample Output3 3 3.6 2 6.0 1 1.6   #include <string.h>#include <iostream>#include <iomanip>using namespa...

2012-11-19 23:50:03 61

原创 PAT1008 Elevator

电梯上升一层6秒,下降一层4秒,每层停留5秒Sample Input: 3 2 3 1 Sample Output: 41      #include <iostream>using namespace std;int main(){ int N; cin>>N; int current = 0...

2012-11-19 23:49:30 68

原创 PAT1007 Maximum Subsequence Sum

求最大连续子串和  Sample Input:10-10 1 2 3 4 -5 -23 3 7 -21Sample Output:10 1 4    #include <iostream>#include <vector>#include <string>using namespace ...

2012-11-18 23:58:22 64

原创 PAT1006 Sign In and Sign Out

请根据记录找出当天开门和关门的人。 Sample Input:3CS301111 15:30:28 17:00:10SC3021234 08:00:00 11:25:25CS301133 21:45:00 21:58:40Sample Output:SC3021234 CS301133    #include <io...

2012-11-18 23:57:56 87

原创 PAT1005 Spell It Right

计算各个数字的和,并用英文将字母一个一个输出。 Sample Input: 12345 Sample Output: one five    #include <iostream>#include <string>using namespace std;char* fun(int x){ switch(x) { ca...

2012-11-18 23:57:30 71

原创 PAT1004 Counting Leaves

 统计树的每一层上叶子节点的个数 Sample Input 2 1 01 1 02 Sample Output 0 1    #include <iostream>#include <iomanip>#include <string>#include <map>#include <vector>us...

2012-11-18 23:56:58 74

原创 PAT1002 A+B for Polynomials

多项式加法 Sample Input 2 1 2.4 0 3.2 2 2 1.5 1 0.5 Sample Output 3 2 1.5 1 2.9 0 3.2    #include <iostream>#include <iomanip>#include <vector>using namespace std;...

2012-11-18 23:56:20 69

原创 DrawText 中DT_NOPREFIX作用

在实际应用中,遇到DrawText绘制2&时,文字乱码。 认真参阅DrawText用法,发现DT_NOPREFIX绘制项。 DT_NOPREFIX关闭前缀字符的处理。 通常DrawText解释助记前缀字符,&为给其后的字符加下划线,解释&&为显示单个&。指定DT_NOPREFIX,这种处理被关闭。 ...

2012-11-17 23:37:39 770

原创 CComboBox使用SetDroppedWidth按照最长的项显示下拉框

实际应用中,ComboBox的下拉框的长度默认是和它的Edit框相同的,如果插入的个别项特别长时会显示不全。 解决方法如下:  CString str; int dx = 0; CSize sz; CDC *pDC = m_CobName.GetDC(); CFont *pOldFont = pDC->Sele...

2012-11-17 23:37:29 485

原创 屏蔽MFC程序中按F1弹出无法打开帮助文件的提示

方案一: 接受处理ID_HELP 消息ON_COMMAND(ID_HELP, OnMenuHelpID) 定义见afxres.h   // special commands for processing help#define ID_HELP 0xE146 // first attempt for F...

2012-11-17 23:37:18 893

原创 SystemParametersInfo中SPI_GETNONCLIENTMETRICS在XP下用法注意

实际应用中,一段代码在Win7下使用正常,在XP下获取字体异常。  ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));NONCLIENTMETRICS nm;nm.cbSize = sizeof (NONCLIENTMETRICS);VERIFY (SystemParametersInfo(SPI_GETNONCLIENTMET...

2012-11-17 23:36:53 398

原创 PAT1001 A+B Format

在一行中输入整数 a 和 b,用空格隔开(-1000000 <= a, b <= 1000000 )输出a+b的值,用千分位格式输出Sample Input-1000000 9Sample Output-999,991 python版本代码如下   import reimport sysdef fun(num): if num ...

2012-11-17 23:36:17 85

原创 自绘CTreeCtrl树节点名称显示不全的问题

在实际应用中,需要自绘CTreeCtrl,全部使用gdi绘制节点和文字,当节点名称较长时会出现显示不全的问题,拖动到最右边的时候仍然不能显示完全。  原因是自绘的字体与CTreeCtrl默认的字体不同造成的。解决方法是向树控件发送WM_SETFONT消息,将默认字体替换为自绘的字体。  CFont* pOldFont;CFont newFont;L...

2012-11-16 16:13:56 423

原创 自绘标题栏在Win7经典模式下刷新异常的问题

实际应用中,程序使用自绘标题栏,在Win7经典模式下进行放大还原操作时出现标题栏绘制不全的问题。 最大化操作后,标题栏的右侧未绘制完全。需要强制进行标题栏刷新后才能正常显示。代码如下: ::SendMessage(this->GetSafeHwnd(),WM_NCPAINT,0,0); 原因分析:打开Aero特效的模式下,绘制均正常,在经典模式下不能进行刷...

2012-11-16 14:47:07 289

原创 利用 SetRedraw 减少闪烁 提高绘制效率

在实际应用中,CTabCtrl或者CListCtrl在插入大量数据时界面绘制变发生剧烈闪烁,并且插入效率较慢。利用SetRedraw可以解决此问题。实际测试CTabCtrl插入上千条记录未优化前需要30~40秒,优化后需要1~2秒。 摘自百度百科CWnd::SetRedraw  void SetRedraw( BOOL bRedraw = TRUE );  参数: bRedraw 指定...

2012-11-16 14:14:13 570

原创 GetAdaptersInfo函数在64位系统下返回ERROR_NOACCESS的问题

实际应用中一个程序在长时间运行后内存占用较高时发生崩溃,从dump信息中,发现GetAdaptersInfo函数返回了一个奇怪的错误码998(ERROR_NOACCESS),百度搜索不到相关的信息。MSDN上GetAdaptersInfo函数的错误码正常情况下只有5种。并且一共发生的两次崩溃都出现在一台Win7 64位机器上,其他测试机器均正常。有问题的代码如下: void GetMa...

2012-11-16 11:58:22 727

原创 【原创】InstallShield制作的安装包在部分Win7系统下安装慢的问题原因

实际应用中遇到installShield2010制作的安装包在Win XP系统下安装十分快速,但在Win7系统下安装会在文件拷贝界面等待2-20分钟。利用Win7的高级任务管理器的“分析等待链”功能查看 显示引起卡住的进程为  dotnetinstaller.exe,这个文件是installshield安装目录下自带的,从字面意义上就可以知道应该是用来安装....

2012-11-16 11:18:59 663 1

空空如也

空空如也

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

TA关注的人

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