- 博客(29)
- 收藏
- 关注
原创 PAT 1025 反转链表
#include #include #define MAXNODE 100001struct Node{ int data; char addr[8]; char next[8];}node[MAXNODE];struct Node *pnode[MAXNODE];int main(void){ char ad[8]; int nnode, k; in
2016-07-08 15:46:44
413
原创 指向函数的指针--回调的基础
花了半天的时间研究回调函数,网上有些写得不对,所以记下备忘。话说回来,,很久没有更新博客了,很多事貌似遗忘了。#includeusing namespace std;class callBackTest;typedef void (callBackTest::*classfunp)(int a,int b,int &c);
2014-12-20 23:23:10
379
原创 PAT 1014 Waiting in Line
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The s
2014-08-25 14:57:20
367
原创 PAT 1004 Counting Leaves
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with a line
2014-08-23 18:04:47
346
原创 PAT 1050 String Subtraction
Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However,
2014-08-23 14:12:38
368
转载 java awt 页面布局
import java.awt.*;import java.awt.event.*;import java.applet.*;//public class CardLayoutDemo extends Applet implements ItemListener{ String msg=""; Checkbox winXP,win7,solaris,mac; //Panel o
2014-08-02 18:24:13
766
原创 pat1080 graduate admission
#include#include#include#includeusing namespace std;#define N 40001#define M 101#define K 6struct Applicant{ int id,ge,gi; double fg; int rank; int prefer[K];};struct School{ in
2014-07-31 14:14:38
424
转载 My First C++ Program in Professional C++
//employee.h#ifndef EMPLOYEE_H#define EMPLOYEE_H#include#includenamespace Records{ int const kDefaultStartingSalary=30000; class Employee { public: Employee(); void promote(int inRais
2014-07-08 14:15:30
505
原创 pat4-06 Data_sturcture 搜索树判断
#includeusing namespace std;struct Node{ int data; Node *left,*right;};bool LessTree(int *a,int start,int end,Node *&tree){ if(start==end) { tree=new Node; tree->data=a[start]; tree-
2014-05-20 21:19:16
705
原创 pat Data structure --4-05家谱处理 数据结构实验项目
without tree,we can still solve this problem.the key point is how to
2014-05-14 14:28:16
1718
原创 Review pat1055 compare cin with scanf,etc..
Now that we prefer to ,why we use in some acm
2014-05-13 13:36:21
523
原创 pat 1055 how to improve the performance
#include#include#include#includeusing namespace std;struct Person{ char name[9]; int age; int worth;};struct Comp{ bool operator()(Person const &per_a,Person const &per_b) { if(per_a
2014-05-12 20:50:27
439
原创 windows 消息队列
#include#include#includeusing namespace std;struct Message{ string msg; int priority;};struct Cmp{ bool operator()(Message const &msg_a,Message const &msg_b) { return msg_a.priority>msg
2014-05-12 15:56:15
626
原创 并查集的基本操作
#includetypedef int T;T const &Find(T const &element,T *father){ if(father[element]<0) { return element; } else { return father[element]=Find(father[element],father); }}T const &Union(
2014-05-12 15:28:02
468
原创 pat Data_Structure 前缀表达式的计算--堆栈法
well,联合的标记问题。。。。怎么弄?#include#includeusing namespace std;struct element{ char op; double nu;};int main(){ stack st; char s[61]; gets(s); double tmp; for(int i=0;s[i]!='\0';++i)
2014-05-09 19:25:00
606
原创 pat Data_stucture 表达式转换-栈的应用
#include#includeusing namespace std;bool p[5][5]={ 1,1,0,0,1, 1,1,0,0,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,1};int con(char ch){ switch(ch) { case'+': return 0; case'-': return 1; cas
2014-05-08 18:10:49
426
原创 pat Data Stucture 海盗分赃
#include#includeusing namespace std;int Median(int a[],int start,int end){ sort(a+start,a+end); return a[(end-start-1)/2+start];}int main(){ int d,p; cin>>d>>p; int a[p],b[p]; a[p-2]=0;
2014-05-07 17:01:12
442
原创 pat 1079 another solution
this solution shows well in time and space complexity,but it exceeds limited time at last
2014-04-28 20:36:14
396
原创 pat 1079
the key point is how to present a tree....data structuretime and space complexity
2014-04-28 18:54:51
446
原创 pat1029 merge
i want to try list first,but the memory exceeds for three cases.
2014-04-28 10:42:30
392
原创 pat 1078 quadratic probing
#include#include#includeusing namespace std;bool isprime(const int &a){ if(a==1) return false; if(a==2) return true; int len=(int)sqrt((double)a); for(int i=2;i<=len;i++){ if(a%i==0) retu
2014-04-22 17:21:31
404
原创 pat1077
#include#includeusing namespace std;int main(){// freopen("C:\\Users\\Frank Wang\\Desktop\\in.txt","r",stdin); stack s1,s2,s3; int n; scanf("%d",&n); getchar(); char c; while((c=getchar())!=
2014-04-21 16:16:24
397
原创 pat 1017
#include#include#includeusing namespace std;struct client{ double arrive_time; double deal_time; bool operator<(const client &b) const{ return arrive_time<b.arrive_time; }};int main(){ fr
2014-04-19 16:53:25
434
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人