2013年12月19日

uva 465 - Overflow

摘要: 这题自己写的太菜了,看了网上的代码,受到很大的启发,有时候大数不一定要用数组,可以用很多方式来替换,一定要多思考,固定思维就是死路。本文代码出处http://blog.csdn.net/zcube/article/details/8458888 1 #include 2 3 const int MINT = 0x7fffffff; 4 5 int main() { 6 7 char str1[1000], str2[1000], ch; 8 9 while (scanf("%s %c %s", str1, &ch, str2) != EOF) {10 11 ... 阅读全文

posted @ 2013-12-19 14:01 云在心 阅读(133) 评论(0) 推荐(0)

2013年12月18日

uva 10106 - Product

摘要: 这一题是大数相乘,还是用了刘汝佳老师的方法,下面提供两个大数相乘的算法bign operator *(const bign& b){ bign c; c.len=len+b.len; for(int i=0;i#include#includeusing namespace std;#define MAXN 600class bign{public: int len,s[MAXN]; bign(){ for(int i=0;i=0;i--,j++) this->s[j]=s[i]-'0'; } ... 阅读全文

posted @ 2013-12-18 21:25 云在心 阅读(106) 评论(0) 推荐(0)

uva 424 - Integer Inquiry

摘要: 这是一题大数相加,如果大数相加一定要用数组做。这里提供一段用两个数组进行相加的算法,是刘汝佳老师编写,s1,s2都是反转过的数组,比如大数为123456789,那数组从0-8的应该是 987654321string ssum(string s1,string s2){ char c[100]; int len=0; int temp=MAX(s1.size(),s2.size()); for(int i=0,g=0;g||i#includeusing namespace std;#define MAX(X,Y) ((X)<(Y))?(Y):(X)void revers... 阅读全文

posted @ 2013-12-18 20:46 云在心 阅读(172) 评论(0) 推荐(0)

2013年12月16日

uva 10115 - Automatic Editing

摘要: 这题很简单,就是不停搜索#include#include#includeusing namespace std;int main(){ int n; string words[15],reword[15],l; while(cin>>n){ getchar(); if(n==0) break; for(int i=0;i=0){ l.replace(start,words[i].size(),reword[i]) } } cout<<... 阅读全文

posted @ 2013-12-16 15:22 云在心 阅读(101) 评论(0) 推荐(0)

uva 644 - Immediate Decodability

摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=585可以学习哈弗曼编码,以及二叉树编码,就知道怎么是immediately code#include#includeusing namespace std;int main(){ string code[5000],l; int num=0,temp=0,numNine=0; while(getline(cin,l)){ if(l[0]=='9'){ ... 阅读全文

posted @ 2013-12-16 13:54 云在心 阅读(155) 评论(0) 推荐(0)

2013年12月12日

生成dll动态链接库后的调用

摘要: 1.把头文件添加2.把.dll和.lib放到文件夹下1 #include "copyFile.h"2 int main(){3 HINSTANCE hDll;4 typedef void(*PSUM)(char* src,char* dst);5 PSUM pSum;6 hDll=LoadLibrary(L"copyFile.dll");7 pSum=(PSUM)GetProcAddress(hDll,"copyFile");8 pSum("D:\\test\\testsrc.txt","D:\\123. 阅读全文

posted @ 2013-12-12 18:03 云在心 阅读(139) 评论(0) 推荐(0)

利用windows api实现遍历目录

摘要: 目录遍历程序程序类型:Console参数:目录名要求:1.目录遍历时,只能使用WindowsAPI函数(FindFirstFile/FindNextFile/FindClose)2.遍历时,深度优先(用递归算法实现)3.使用printf输出目录及文件名4.同时将输出结果写入C:\filelist.txt中 1 #include 2 #include 3 #include 4 #include 5 FILE* fp; 6 void searchCatalog(char* root){ 7 char temp[100]; 8 strcpy(temp,root); 9 str... 阅读全文

posted @ 2013-12-12 15:03 云在心 阅读(1918) 评论(0) 推荐(0)

利用windows api实现文件拷贝

摘要: 程序类型:Console参数:源文件名目的文件名要求:1.只能使用WindowsAPI函数(CreateFile/ReadFile/WriteFile/CloseHandle)完成注意点:这里面涉及unicode和ansi编码问题,因为vs初始设置为unicode,所以你输入字符串时要转为wchar有以下方法可以参考:1.把字符编码方式修改为未设置,或者ansi2.L"string",加L#include#includeint main(int argc,TCHAR* argv[]){ if(argc!=3){ return 0; } HANDLE handle... 阅读全文

posted @ 2013-12-12 13:18 云在心 阅读(1167) 评论(0) 推荐(0)

2013年12月10日

uva 10815 - Andy's First Dictionary

摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756好简单的一道题,居然一直runtime erro,么办法咯 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 vector words; 8 int main(){ 9 string l;10 vector::iterator it;11 while(getline( 阅读全文

posted @ 2013-12-10 21:21 云在心 阅读(141) 评论(0) 推荐(0)

2013年12月9日

uva 10878 - Decode the tape

摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1819这题很简单,就是一个ascii转换,不过代码写的好丑啊,buff数组开大点,他没说上限多少行,还是要注意的。 1 #include 2 #include 3 #include 4 using namespace std; 5 void string_replace(string &src){ 6 for(int i=0;i<src.size();i++){ 7 阅读全文

posted @ 2013-12-09 20:55 云在心 阅读(169) 评论(0) 推荐(0)

导航