- 博客(45)
- 资源 (5)
- 收藏
- 关注
原创 约瑟夫环问题 实习1-1.2
#include#include#define N 41#define M 3#define START 0struct LinkList{ int data; struct LinkList* link;}LNode[N];typedef struct LinkList Linklist;typedef LinkList* link;int main(){
2015-03-31 20:23:34 613
原创 UVa1210 - Sum of Consecutive Prime Numbers
#includeconst int maxn=10010;int isp[1250],pre_p,sum[1250];bool np[maxn]={true,true};void prepare(){ for(int i=2;i<maxn;++i){ if(!np[i]) isp[pre_p++]=i; for(int j=0
2015-03-28 23:55:50 696
原创 UVa1641 - ASCII Area
#includeint m,n;int main(){ while(scanf("%d%d",&m,&n)!=EOF){ int sum=0; getchar(); for(int i=0; i<m; i++){ bool q = false; for(int j=0;j<n;j++){
2015-03-28 23:34:01 666
原创 UVa1644 - Prime Gap
#includeusing namespace std;const unsigned maxn = 1300010;int p[maxn], n;bool np[maxn] = {true, true};int main(){ ios::sync_with_stdio(false); for(int i=2; i<maxn; i++){ if(!np[i
2015-03-28 23:29:20 724
原创 UVa 10410 - Tree Reconstruction
#include#include#include#include#includeusing namespace std;const int maxn = 1005;int N, pos[maxn];vector g[maxn];int main(){ while(scanf("%d",&N)==1){ int x; for(int i=
2015-03-28 16:49:38 515
原创 UVa810 - A Dicey Problem
#include #include #include using namespace std;const int D[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1};const int N = 15;char str[25];int n, m, sx, sy, u, f, to[7][7], g[N][N];int vis[N][N][7][7];str
2015-03-28 15:29:04 516
原创 c++ 中 pair 的 使用方法
pair的类型: pair 是 一种模版类型。每个pair 可以存储两个值。这两种值无限制。也可以将自己写的struct的对象放进去。。 pair p; pair p; pair p; 都可以。。。 应用:如果一个函数有两个返回值 的话,如果是相同类型,就可以用数组返回,如果是不同类型,就可以自己写个struct ,但为了方便就可以使用
2015-03-28 12:07:06 993
原创 Floodfill(DFS)
今天有写了一边感觉挺明白的,要精心,思考,无非就是便利每一个找到的’@‘,然后找它的八个方向,一直循环递归#include#includeconst int maxn = 100 + 5;char pic[maxn][maxn];int m, n, idx[maxn][maxn];void dfs(int r, int c, int id){ if(r = m ||
2015-03-28 11:51:53 674
原创 UVa246-10-20-30
#include#include#include#include#include#includeusing namespace std;typedef deque deq;const char sign[3][10] = {"Draw:","Loss:","Win :"};int step;vector s;bool judge_end(){ for(int i
2015-03-28 11:15:33 1029
原创 set::count
set::countVisual Studio .NET 2003其他版本Returns the number of elements in a set whose key matches a parameter-specified key.size_type count( c
2015-03-28 10:48:41 1070
原创 <deque>
#include deque容器类与vector类似,支持随机访问和快速插入删除,它在容器中某一位置上的操作所花费的是线性时间。与vector不同的是,deque还支持从开始端插入数据:push_front()。
2015-03-28 09:54:24 418
原创 方片3
segregate隔离并区别对待partition分隔物分开subdivide再分细分allocate分配分派dispense分配分发distribute分发分布allotment小块土地quota定额定量decline下倾v.婉言谢绝reject拒绝丢弃n.被拒绝的人plus加的deduct扣除减去subtract减multiply增加
2015-03-27 14:31:16 758
原创 黑桃3
subsidiary附属的taboo禁忌v. 忌讳的a.optimistic乐观主义的mastermind犯罪策划者graphic生动的hamper妨碍阻碍牵制hinder阻止妨碍inhibit阻止妨碍interfere干涉干扰妨碍打扰invaluable非常宝贵的precious珍贵的junk无用的peg挂衣钩v.固定限定stake桩利害关
2015-03-27 12:39:31 536
原创 黑桃3
accumulate积累cumulative累积的assemble集合集会convene召集召开converge聚积汇集相交会合rally集合重新聚积n.集会恢复summon召唤disperse分散消散interfere干涉干扰妨碍打扰invaluable非常宝贵的precious珍贵的junk无用的peg挂衣钩v.固定限定stake桩利害关系赌
2015-03-27 12:13:42 584
原创 红桃3
clip电影片段eclipse日食月食消失evaporate蒸发消失vanish绝技突然完全消失carve雕刻切片sculpture雕刻品soak浸泡浸湿absorb吸收使专心吞并assimilate同化消化digestive消化的suck吸吮sip小口喝lick添aid帮助assist援助auxiliary辅助的补助的
2015-03-27 12:12:27 545
原创 红桃A
抛弃 abandondiscard击退 repel抵制 boycottn.阻止 precludeprohibit愤怒的 indignant a.outragen.ragefuryn.断气 expireperish喘气 gasp层 layerstorey楼梯 staircase
2015-03-27 12:03:21 727
原创 梅花A
紧张 straintension n.空闲 leisure n.极速 haste n.小册子 booklet n.brochure n.leaflet n.pamphlet n.tract n.tract n. 地带施加 exertimposeinflict旅行 excursion n.expedition n.hike
2015-03-26 09:25:37 518
原创 第二章 线性表 顺序表的实现
#include#include//----------线性表的动态分配顺序存储结构----------#define LIST_INIT_SIZE 100 //线性表存储空间的初始化分配量#define LISTINCREMENT 10 //线性表存储空间的分配增量#define OVERFLOW -2typedef struct{ int *elem; // 存储空间基址
2015-03-26 09:07:31 460
原创 黑桃A
梯田 terrace居住 dwellpopulateresideinhabit保护 preservereserveconserve维持 maintainsustainretain超过 surpassovertakeexceedexcesstranscend
2015-03-26 08:10:59 542
原创 UVa1599 - Ideal Path
#include#include#include#includeusing namespace std;const int maxn=100010;const int inf=1<<30;int n,vis[maxn],d[maxn];vector g[maxn],ans;struct way{ int u,v,c; way(int u=0,int v=0,int
2015-03-16 09:01:09 1236
原创 UVa506 - System Dependencies
#include#include#include#include#include#includeusing namespace std;const int maxn=10000;int cnt,status[maxn];string name[maxn];mapids;vector depend[maxn],depend2[maxn],installed;int get_i
2015-03-16 08:55:00 836
原创 UVa 11853 - Paintball
#include#include#include#includeusing namespace std;const int maxn=1000+10;const double w=1000;struct Ball{ double x,y,r; Ball(double x=0,double y=0,double r=0):x(x),y(y),r(r){}}ball
2015-03-16 08:50:33 708
原创 周记
本周开学第一周,表现很好,没有玩游戏上瘾,而且运动了几次,无逃课,生物钟运作良好,还去做了兼职,美中不足的是感觉目标不明确,努力的没有方向感,所以要乐观,要时刻保持努力,再次明确下目标,1,学习2,刷题,虽说是兴趣为主,但必须保持题量,一天至少弄明白3道!,其他继续保持,作息只早不晚,看好你呦
2015-03-14 08:11:22 425
原创 UVa1103 - Ancient Messages
#include#include#includeusing namespace std;const int maxn=210;const int a[6]={1,5,3,2,4,0};const char b[7]="WAKJSD";int h,w,cnt[6],ct;bool vis[maxn][maxn],g[maxn][maxn];maphex;void pre(){
2015-03-12 17:00:15 860
原创 UVa822 - Queue and A(看着也写不利索的结构体)
#include#include#includeusing namespace std;struct topic{ int tid, num, t0, t, dt, q_num, finished;};struct member{ int pid, k, work_left, last; vector pidk; bool operator < (con
2015-03-11 15:41:46 993
原创 汉诺塔(弄不利索的递归)
#includevoid hannuota(int n, char a, char b, char c){ /* 如果是1个盘子 直接将a柱子上的盘子移到c 否则 先将a柱子上的n-1个盘子借助c移到b 直接将a柱子上的盘子从a移到c 最后将b上的n-1个借助a移到c */ if(
2015-03-11 15:14:51 537
原创 C++中class关键字
在C++ 语言中class是定义类的关键字,C++中也可以使用struct定义类。两者区别是,用class定义的类,如果数据成员或成员函数没有说明则默认为private(私有)的,而用struct定义的,默认为public(公共)的。 示例 #include using namespace std; class C { public: int getAge() co
2015-03-10 08:54:23 2822
原创 UVa12333 - Revenge of Fibonacci
#include#include#include#includeusing namespace std;#define nodesize 4000004#define dictsize 10typedef struct node1{ int id; int flag; node1* next[dictsize];}tnode;tnode dict[nod
2015-03-10 08:49:02 1163
原创 计划
物理挂了。。。挂了就是挂了,在事实面前好好反思就是了。由此确立一个大目标,好让剩下的大学生涯有方向。1,考研是一地位的,计算机系,我的数学基础和英语基础都不算好,专业课还没开,所以平日里做到每日背单词,做阅读是必须的。数学暂不考虑2,刷题还是应该继续下去,但要把它视为一种兴趣的存在,太难可以看题解,但要理解,掌握该掌握的知识点。分析自身的缺点;1.努力是有的,但是缺乏长期的
2015-03-05 12:45:47 418
原创 cin.get()和cin.getline()之间的区别
以下是对cin.get()和cin.getline()的区别进行了详细的分析介绍,需要的朋友可以过来参考下,希望对大家有所帮助cin.getline()和cin.get()都是对输入的面向行的读取,即一次读取整行而不是单个数字或字符,但是二者有一定的区别。cin.get()每次读取一整行并把由Enter键生成的换行符留在输入队列中,比如:复制代码代码
2015-03-05 12:17:05 447
原创 UVa1597 - Searching the Web
1 题目理解 刘老师对这题的介绍是这样的: 看到该题,最容易想到的方法,就是对于每次请求,都去搜索1500行文档的信息。但是这样效率过低,会超过3秒的限制时间。故这题靠LRJ给出的题目要求还不够,还需要读英文原题,因为原题里有这道题的解题思路。以下是我对前四段话的翻译(本人英语四级未过,不对翻译质量负责~~):
2015-03-05 01:34:24 796
原创 UVa207 - PGA Tour Prize Money
#include#include#include#include#include#includeusing namespace std;const int DQ = 500000000;struct record{ string name, place; int rd[4], total2, total4; double money; bool pr
2015-03-05 01:30:59 1140
原创 UVa508 - Morse Mismatches
输入字母的莫尔斯编码、字典,之后输入编码过的单词,要求输出对应的单词。使用map保存莫尔斯编码,读入字典后,将每个单词的编码保存在vector中并排序。然后对于每个输入莫尔斯编码串,与字典比对进行输出。紫书书上第四章的题,学过STL之后做更加简单。#include#include#include#include#includeusing namespace std;string
2015-03-05 00:00:18 897
原创 UVa509 - RAID!
#includeusing namespace std;int d, s, b, kase=0;char type;char tab[8][8000];bool Fix(){ for(int i=0;i<s*b;++i){ int sum=0,cnt=0,x_no; for(int j=0;j<d;++j){ if(tab[
2015-03-04 23:04:06 1218 1
原创 unique()
unique()函数是一个去重函数,STL中unique的函数 unique的功能是去除相邻的重复元素(只保留一个),还有一个容易忽视的特性是它并不真正把重复的元素删除。他是c++中的函数,所以头文件要加#include,具体用法如下: int num[100]; unique(num,mun+n)返回的是num去重后的尾地址,之所以说比不真正把重复的元素删除,其实是,该
2015-03-04 08:58:46 438
原创 UVa10539 - Almost Prime Numbers
#includeusing namespace std;typedef long long LL;const int maxn=1000010;LL isp[78500],pre_p;bool np[maxn]={true,true};void prime(){ for(int i=2;i<maxn;++i){ if(!np[i]) isp[pre_p++]=i
2015-03-03 21:28:57 773
原创 UVa207 - PGA Tour Prize Money(崩溃了)
时间限制:3.000秒题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=835&page=show_problem&problem=143 就是一道暴复杂的大模拟…… 简单整理下题意吧,就是让你按照高尔夫球赛的规则处理给出的数据。规则是一共有四
2015-03-03 15:29:55 953
原创 UVa221 - Urban Elevations
#include#includeusing namespace std;const int maxn = 100 + 5;struct Building{ int id; double x,y,w,d,h; bool operator < (const Building& rhs) const { return x < rhs.x || ( x ==
2015-03-03 15:22:08 910
原创 UVa1595 - Symmetry
#includeusing namespace std;const int N = 1005;int x[N], y[N], n, mx;bool have(int i){ for(int j=0;j<n;++j) if(y[i]==y[j] && x[i]+x[j]==2*mx) return true; return false;}int main(
2015-03-01 22:35:23 557
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人