自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

NITjianbagengmu的博客

我只是用算法活跃我生锈的大脑

  • 博客(275)
  • 收藏
  • 关注

原创 6-2 Evaluate Postfix Expression(25 分)_后缀表达式求值

6-2 Evaluate Postfix Expression(25 分) Write a program to evaluate a postfix expression. You only have to handle four kinds of operators: +, -, x, and /. Format of functions:ElementType EvalPostfix( c

2017-11-27 14:03:45 5483 2

原创 PTA_6-4 另类堆栈(15 分)_单指针栈

6-4 另类堆栈(15 分) 在栈的顺序存储实现中,另有一种方法是将Top定义为栈顶的上一个位置。请编写程序实现这种定义下堆栈的入栈、出栈操作。如何判断堆栈为空或者满? 函数接口定义:bool Push( Stack S, ElementType X ); ElementType Pop( Stack S ); 其中Stack结构定义如下: typedef int Position; t

2017-11-27 14:02:39 8698

原创 Bit String Reordering UVALive - 6832

给你 n,m 第一行有n个,第二行m个; n 行 就只有0,1;接下来就是有m个数字,代表有多个连续的0或者1 6 3 1 0 0 1 0 1 1 3 2转成 011100这样的最小操作次数/*#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using name

2017-11-26 22:39:03 204

原创 nit_241_三角形数

B. 三角形数1 12 3 2 3 4 5 6 4 5 6 7 8 9 10形如此类的为三角形数{1,3,6,10},现在我想知道接下来给出的数字是不是三角形数,聪明的你能否帮我解决一下这个问题?Input 多组案例每一行输入一个n 求n是否为三角形数1<=n<=1e9Output 若n为三角形数,请输出Yes否

2017-11-26 22:23:43 192

原创 poj_1287_prime

NetworkingYou are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect p

2017-11-26 22:17:59 211

原创 poj_1258_prime_就是dj减配版

Agri-NetFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John ordered a

2017-11-26 22:11:50 142

原创 计蒜课_F. Falling Apart

两个人一前以后拿数字都最大程度拿输出拿的结果#include<bits/stdc++.h>using namespace std;int main(){ int n,a[111],i,j; while(cin>>n) { for(i=0;i<n;i++) scanf("%d",a+i); sort(a,a+n);

2017-11-25 19:10:58 201

原创 计蒜客_A. Amsterdam Distance_思维

给你图片让你走,只有两种走法#include<bits/stdc++.h>using namespace std;#define pi acos(-1.0)int main(){ // cout<<pi<<endl; // printf("%lf\n",2.0/5+(pi*(4.0/5)*3)/6); double n,l,r,x,y,xx,yy; while(c

2017-11-25 19:08:47 288

原创 计蒜客_King of the Waves_dfs

Translate 给你n,代表有0 n-1个人,给你n行,每行n个字符, 字符是X,i=j就是这个人在这个位置 1 代表,i人能赢j人当king 0代表输; 游戏规则是b 是king a能赢b a当king 问裁判按什么安排顺序0能当king //#include<bits/stdc++.h>#include<iostream>#include<vector>#include

2017-11-25 19:05:04 360

原创 nitoj_244_很有意思的贪心

SYS招新啦! ES天天在SYS没事干,忽然想组织一波招新以扩大SYS的队伍。然后有一堆萌新报名了,所有萌新的关系都特别好,因为同性。因为萌新实在是太多了,ES想要做一个刷选,来刷掉一些人。ES使用超自然力,造了一条很长很长的直线跑道,萌新被带到了跑道上面,跑道上有些位置存在宝石,坏坏的ES说:“如果你们能按规定的时间拿到宝石并到我指定的点,就算你们晋级了!”每个萌新,宝石以及ES指定的位置都在同

2017-11-25 18:54:33 292

原创 codeforce 829C

PridePrev Submit Status Statistics Next You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one o

2017-11-22 21:17:55 221

原创 Evaluate Postfix Expression_后缀表达式求解

6-2 Evaluate Postfix Expression(25 分) Write a program to evaluate a postfix expression. You only have to handle four kinds of operators: +, -, x, and /. Format of functions:ElementType EvalPostfix( c

2017-11-20 20:10:26 2752

转载 主席树

主席树搞了一个多星期TAT,,,,,,也只是大致领悟而已!!!主席树又称函数式线段树,顾名思义,也就是通过函数来实现的线段树,至于为什么叫主席树,那是因为是fotile主席创建出来的这个数据结构(其实貌似是当初主席不会划分树而自己想出来的另一个处理方式。。。。是不是很吊呢? ORZ...)不扯了,切入正题。主席树就是利用函数式编程的思想来使线段树支持询问历史版本、同时充分利用它们之间的共同

2017-11-07 19:20:05 164

原创 6-3 在一个数组中实现两个堆栈(20 分)-pta_same_无聊的水体

6-3 在一个数组中实现两个堆栈(20 分) 本题要求在一个数组中实现两个堆栈。 函数接口定义:Stack CreateStack( int MaxSize ); bool Push( Stack S, ElementType X, int Tag ); ElementType Pop( Stack S, int Tag ); 其中Tag是堆栈编号,取1或2;MaxSize堆栈数组的规模;

2017-11-06 14:55:49 2438 3

原创 6-1 Two Stacks In One Array-PTA双指指针stack表操作实现

6-1 Two Stacks In One Array(20 分) Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used. Format of fun

2017-11-06 14:12:47 1455

原创 Codeforces Round #442 (Div. 2) A. Alex and broken contest,B - Nikita and string

A. Alex and broken contest time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One day Alex was creating a contest about his friends, but acci

2017-11-04 09:47:49 347

原创 Codeforces Round #441 D. Sorting the Coins

B. Sorting the Coins time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output Recently, Dima met with Sasha in a philatelic store, and since then th

2017-10-29 20:33:21 246

原创 hdu_1698_线段树区间更新

注意, 1 ,区间查询写错,ll,rr和m的比较 2 ,lazy 标记算的长度在右区间不用加1更新分析,如果把线段树的每个点都更新,线段树就不再有logn的优势,所以有用一个标记表示在这个区间内有需要更新的,等你查询要用时再重新更新,#include<iostream>#include<cstdio>using namespace std;#define L l,m,u<<1#defin

2017-10-29 14:27:34 388

原创 Gym 100112H Horror List—深搜—bfs

It was time for the 7th Nordic Cinema Popcorn Convention, andthis year the manager Ian had a brilliant idea. In addition to thetraditional film program, there would be a surprise room where asmall g

2017-10-26 22:26:40 359

原创 Gym 100112D Doorman 模拟—水

The doorman Bruno at the popular night club Heaven is having a hard time fulfilling his duties. He was told by the owner that when the club is full, the number of women and men let into the club sho

2017-10-26 22:19:14 290

原创 Gym 100112C Cookie Selection ,不停插入输出中位数

As chief programmer at a cookie production plant you havemany responsibilities, one of them being that the cookies producedand packaged at the plant adhere to the very demandingquality standards of

2017-10-26 22:15:11 309

原创 Gym 100112A Aaah!

Jon Marius shouted too much at the recent Justin Bieber concert, and now needs to go to the doctor because of his sore throat. The doctor’s instructions are to say “aaah”. Unfortunately, the doctors

2017-10-26 22:09:25 436

原创 nitoj_202_二分——将区间分为三个部分

Sequence Time Limit: 500msMemory Limit: 65536KB 64-bit integer IO format: %lld Java class name: Main Prev Submit Status Statistics Next 袁学长又来啦,这次他有一个长度为n的数列a1 a2 … an,他想知道能否在这个数列中找到三个数使它们的和为零,

2017-10-22 21:28:37 541

原创 hdu 1754_单点更新,区间查询,查询注意if(rr>m) if (ll <= m)

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0#include<iostream>#include<

2017-10-22 10:00:31 221

原创 I - Por Costel and the Pairs Gym - 100923I _思维啊——可惜我现在还没

We don’t know how Por Costel the pig arrived at FMI’s dance party. All we know is that he did.The dance floor is hot because Por Costel broke the air conditioner. On the dance floor, the boys and girls

2017-10-21 22:24:16 530

原创 L - Por Costel and the Semipalindromes Gym - 100923L

Por Costel the pig, our programmer in-training, has recently returned from the Petrozaporksk training camp. There, he learned a lot of things: how to boil a cob, how to scratch his belly using his keyb

2017-10-21 20:07:17 572

原创 A - Por Costel and Azerah Gym - 100923A

Por Costel the Pig has received a royal invitation to the palace of the Egg-Emperor of Programming, Azerah. Azerah had heard of the renowned pig and wanted to see him with his own eyes. Por Costel, hav

2017-10-21 20:00:31 410

原创 hdu_1166_线段树_单点更新_区间求和

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所

2017-10-21 10:56:53 175

原创 codeforce_876A_水

Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding pat

2017-10-20 21:06:32 778

原创 codeforce_876B_ B - Divisiblity of Differences

You are given a multiset of n integers. You should select exactly k of them in a such way that the difference between any two of them is divisible by m, or tell that it is impossible.Numbers can be rep

2017-10-20 21:01:42 230

原创 codeforce_876C_Classroom Watch

C. Classroom Watch Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teache

2017-10-19 19:22:04 282

原创 hdu_2609_循环字符串的最小字典序

Problem Description Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How many kinds of necklaces total have.(if two necklaces can equal by rotating ,we say th

2017-10-18 22:31:09 628

原创 c_/c++小函数笔记_持续更新

include&amp;amp;lt;cmath&amp;amp;gt;log 相关; 1 ,log10() 2 ,ln() 3 ,log(m)/log(n)=log(n,m);相上下取整 ceil(),floor()#include&amp;amp;lt;cstring&amp;amp;gt;1 ,strncmp() int strncmp ( const char * str1, const char * str2, size...

2017-10-18 18:49:56 213

原创 6-5 链表逆置(20 分)——头插或者重开新链表头插

6-5 链表逆置(20 分) 本题要求实现一个函数,将给定单向链表逆置,即表头置为表尾,表尾置为表头。链表结点定义如下:struct ListNode { int data; struct ListNode *next; }; 函数接口定义:struct ListNode *reverse( struct ListNode *head ); 其中head是用户传入的链表的

2017-10-14 20:38:54 7451 2

原创 6-4 建立学生信息链表(20 分)——尾插建链表_题程序访问是越界——真是醉了,你自己跑下是会抛出异常的

**6-4 建立学生信息链表(20 分)本题要求实现一个将输入的学生成绩组织成单向链表的简单函数。函数接口定义:void input();该函数利用scanf从输入中获取学生的信息,并将其组织成单向链表。链表节点结构定义如下:struct stud_node { int num; /*学号*/ char name[20]

2017-10-14 13:26:44 6717

原创 6-3 逆序数据建立链表(20 分)_头插法建链表

6-3 逆序数据建立链表(20 分) 本题要求实现一个函数,按输入数据的逆序建立一个链表。函数接口定义:struct ListNode *createlist(); 函数createlist利用scanf从输入中获取一系列正整数,当读到−1时表示输入结束。按输入数据的逆序建立一个链表,并返回链表头指针。链表节点结构定义如下:struct ListNode { int data;

2017-10-14 13:15:22 16637 4

原创 6-2 单链表结点删除(20 分)_单链表的删除节点的两种方式——还是双指针和链表覆盖好用

6-2 单链表结点删除(20 分) 本题要求实现两个函数,分别将读入的数据存储为单链表、将链表中所有存储了某给定值的结点删除。链表结点定义如下:struct ListNode { int data; ListNode *next; }; 函数接口定义:struct ListNode *readlist(); struct ListNode *deletem( struct

2017-10-14 12:56:24 9002

原创 pta_链表_递增的整数序列链表的插入_(插入创建操作)

6-1 递增的整数序列链表的插入(15 分) 本题要求实现一个函数,在递增的整数序列链表(带头结点)中插入一个新整数,并保持该序列的有序性。 函数接口定义:List Insert( List L, ElementType X ); 其中List结构定义如下: typedef struct Node *PtrToNode; struct Node { ElementType Dat

2017-10-14 09:55:43 2119

原创 链表笔记一

链表搞了两个星期,说实话让我不用模板我还真写不来创建链表结构体typedef struct library List;typedef struct library Position;struct library{ int offical_number; char book_name[100]; int book_num; List *next;};链表

2017-10-13 21:27:12 247

原创 hdu_4847_kmp_水

Wow! Such Doge! Time Limit: 1000msMemory Limit: 32768KB This problem will be judged on HDU. Original ID: 4847 64-bit integer IO format: %I64d Java class name: Main Prev Submit Status Statistics

2017-10-06 21:57:31 344

空空如也

空空如也

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

TA关注的人

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