12 2013 档案

uva 10194 - Football (aka Soccer)
摘要:又是wa,有点搞不懂 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 typedef struct infoteam{ 9 string name; 10 int games; 11 int point; 12 int win; 13 int tie; 14 int lose; 15 int difference; 16 int score; 17 int against;... 阅读全文

posted @ 2013-12-31 10:42 云在心 阅读(196) 评论(0) 推荐(0)

uva 123 - Searching Quickly
摘要:这题是wa,现在没时间改,应该是单词搜寻那里有问题,搜th,the也能搜到 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef struct combine{ 8 string word; 9 int i;10 string replaceword;11 bool operator dictionnary;23 int main(){24 vector igwords;25 vector sentence;26 s... 阅读全文

posted @ 2013-12-30 19:24 云在心 阅读(127) 评论(0) 推荐(0)

uva 400 - Unix ls
摘要:这题其实很简单,但是re了很多次,因为天真到用setw,以及cout 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 int main(){10 int n;11 vector words;12 while(cin>>n){13 getchar();14 string l;15 int max=0;16 for(int i=0;i0)?(n/columnnum+1):(n/c... 阅读全文

posted @ 2013-12-26 21:48 云在心 阅读(168) 评论(0) 推荐(0)

uva 156 - Ananagrams
摘要:思路:1.先读取单词,把单词都整齐一下,从大写变为小写2.把单词按字母进行排序3.判断接下来的单词和前面的单词是否重复 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 vector newwords; 8 vector num; 9 vector oldwords;10 int main(){11 string l;12 vector::iterator it;13 while(getline(cin,l)){14 if(l[0]=='#... 阅读全文

posted @ 2013-12-26 20:12 云在心 阅读(192) 评论(0) 推荐(0)

uva 120 - Stacks of Flapjacks (RE)
摘要:一直runtime error,这题要注意,有可能数字是重复的。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 vector q_numb; 8 int len; 9 void q_sort(vector &numb){10 int max=0,pos=0,i=0;11 for(vector::iterator it=numb.begin();it!=numb.end();it++,i++){12 if(max(temp.c_str())));43... 阅读全文

posted @ 2013-12-26 14:41 云在心 阅读(142) 评论(0) 推荐(0)

uva 299 - Train Swapping
摘要:水题。。。 1 #include 2 using namespace std; 3 int main(){ 4 int n; 5 int num[51]; 6 cin>>n; 7 while(n--){ 8 int l,cishu=0; 9 cin>>l;10 for(int i=0;i>num[i];12 for(int i=0;inum[j]){15 int temp=num[i];16 num[i]=num[j];... 阅读全文

posted @ 2013-12-25 20:37 云在心 阅读(190) 评论(0) 推荐(0)

uva 152 Tree's a Crowd
摘要:突然不能登了,玩了局dota,编了这题,这题还是比较简单,英语拙计啊 1 #include 2 #include 3 #include 4 using namespace std; 5 int x[5010],y[5010],z[5010]; 6 int main(){ 7 int num=0,a[10]; 8 for(int i=0;i>x[num]>>y[num]>>z[num]){11 if(!x[num]&&!y[num]&&!z[num])12 break;13 num++;14 }15 for(... 阅读全文

posted @ 2013-12-25 17:04 云在心 阅读(116) 评论(0) 推荐(0)

uva 10474 Where is the Marble?
摘要:排序而已。。。。不过时间有点长,以后再考虑考虑怎么写 1 #include 2 #include 3 #include 4 using namespace std; 5 vector num; 6 int main(){ 7 int n,q,cishu=1; 8 vector::iterator result; 9 while(cin>>n>>q){10 if(!n&&!q)11 break;12 int temp;13 for(int i=0;i>temp;15 num.p... 阅读全文

posted @ 2013-12-25 14:12 云在心 阅读(134) 评论(0) 推荐(0)

uva 10420 - List of Conquests
摘要:这题写的好丑啊,这题感觉就是烦1.先要把单词读到一个数组,并记录次数2.对单词进行排序虽然只有0.022s,感觉写的太丑了不过这题温习了一下vector的用法,还有qsort的用法 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define MIN(a,b) ((a)>(b))?(b):(a) 9 using namespace std;10 vector v_word;11 vector v_num;12 typedef struct Node{13 string s;.. 阅读全文

posted @ 2013-12-25 13:44 云在心 阅读(186) 评论(0) 推荐(0)

uva 340 Master-Mind Hints
摘要:这题就是判断,先判断正确的,再判断位置不对但是数字对的这题开始提交都是 runtime error因为数组开的太小了,以后开大点。 1 #include 2 using namespace std; 3 int same,diff; 4 void juge(int len,int a[],int b[]){ 5 int tempa[1000],tempb[1000]; 6 same=0,diff=0; 7 for(int i=0;i>n){31 if(n==0)32 break;33 for(int i=0;i>a... 阅读全文

posted @ 2013-12-23 20:43 云在心 阅读(285) 评论(2) 推荐(0)

uva 748 - Exponentiation
摘要:这是计算指数的,刚开始不知道该怎么做,然后查看了一些网上的代码,只要把小数点去掉后,接下来就是大数相乘了我在做的时候一下几点要注意1.小数点位数要记住2.像0.0100后面的两个0应该去掉在做的时候还wa了一次,主要是格式没对,它要求前置0和后尾0 都去掉下面给出accept的代码 1 #include 2 #include 3 using namespace std; 4 #define MAXN 300 5 struct bign{ 6 int len,s[MAXN]; 7 bign(){ 8 len=1; 9 for(int i=0;i=... 阅读全文

posted @ 2013-12-23 12:22 云在心 阅读(183) 评论(0) 推荐(0)

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 云在心 阅读(134) 评论(0) 推荐(0)

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 云在心 阅读(108) 评论(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 云在心 阅读(174) 评论(0) 推荐(0)

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 云在心 阅读(102) 评论(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 云在心 阅读(157) 评论(0) 推荐(0)

生成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 云在心 阅读(141) 评论(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 云在心 阅读(1921) 评论(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 云在心 阅读(1174) 评论(0) 推荐(0)

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 云在心 阅读(144) 评论(0) 推荐(0)

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)

uva 409 - Excuses, Excuses!
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=350这题没什么难度,一定要注意的地方是单词的判断,比如搜索单词word ,如果出现dword是不算的。这题一次性ac#include#include#includeusing namespace std;void convert(int len,string src[],string dis[]){ //拷贝到复制数组进行大小写转换 for(int i=0;i>k>&g 阅读全文

posted @ 2013-12-09 15:53 云在心 阅读(142) 评论(0) 推荐(0)

uva 537 - Artificial Intelligence?
摘要:这题看题目时要细心,讲一下做题步骤1.得到 P,I,U的double值,可以用string类型中搜索法2.确定精度3.得到目标值因为在输出时忘记打印P=,U=,I=,还wa了一次#include#include#include#include#includeusing namespace std;int main(){ int n,num=1; string annotation[]={"P=","I=","U="}; string character[]={"W","A","V&qu 阅读全文

posted @ 2013-12-09 11:00 云在心 阅读(204) 评论(0) 推荐(0)

导航