自定义博客皮肤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的博客

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

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

原创 string 类主要函数操作笔记

string 类主要函数操作笔记string s=”123”,s2=”1”;s.append(“zxcv”); //s=”asdssfghjklzxcv”,参数必须为string类型 不可为char。 s.assign(“qwert”); //s=”qwert”,相当于赋值操作,赋以新值 ,参数不可为char。s.find(s2,pos) //pos寻找的起始位置, 找不到返回string:

2017-09-28 21:37:20 248

原创 hdu_2594_求串s1的前缀和串s2后缀最大相同部分

Simpsons’ Hidden TalentsHomer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had. Marge: Yeah, what is it? Homer: Take me for example. I want to find out if I ha

2017-09-28 21:36:30 586

原创 poj_2752_kmp_nxt_application_求s 所有子串是s的前缀又是后缀的长度

The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek th

2017-09-23 22:09:17 326

原创 hdu_1850_最后取完的赢_求赢家第一步有多少选择_简单尼姆博弈应用

一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地做回早餐如果愿意 你还可以和爸妈说 咱们玩个小游戏吧 ACM课上学的呢~下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M);两人轮流进行;每走一步可以任意选择一堆并取走其中的任意张牌;桌子

2017-09-22 21:50:28 397

原创 poj_2234_尼姆博弈_最后取完的赢

Sample Input 2 45 45 3 3 6 9 Sample Output No Yes//#include<bits/stdc++.h>#include<iostream>#include<cstdio>using namespace std;int main(){ int t,n,i,j; while(cin>>n) {

2017-09-22 21:23:34 249

原创 hdu_1907_尼姆博弈_最后一个取完就输掉

题意: Sample Input 2 3 3 5 1 1 1 Sample Output John Brother给你 t组案例, 给你n堆 下面n堆每堆有多个a个;每次取1-a个,最后取完的输掉;解; 关于尼姆博弈,玄学; 什么时间一定输; 1,奇数个1 ; 2,存在a>1; 面对xor和为0; x

2017-09-22 20:45:08 503

原创 hdu_1358_kmp_next_数组简单应用

题意: Sample Input 3 aaa 12 aabaabaabaab 0 Sample Output Test case #1 2 2 3 3Test case #2 2 2 6 2 9 3 12 4告诉你字符串的长度,给你字符串s 让你求字符串1-i中可以存在k个子串构成i-i这个串; 输出当前i 和k;解; 直接想到nxt数组求循环节,但

2017-09-21 20:10:30 164

原创 hdu_3746_kmp_给你一个字符串要求你添加最少的字符串使字符串最少循环两次

题意: 给你一个字符串要求你添加最少的字符串使字符串最少循环两次, Sample Input 3 aaa abca abcde Sample Output 0 2 5 解; kmp_next求最小循环结,然后直接求最小添加就行#include<bits/stdc++.h>using namespace std;const i

2017-09-21 19:40:43 452

原创 hdu_2087_两个kmp板子

一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Sample Input abcde a3 aaaaaa aa # Sample Output 0 3#include<bits/stdc++.h>using namespace std;const int N=(int)1e6+10;

2017-09-20 18:39:50 196

原创 hdu_1711_kmp板子

Number SequenceGiven two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] =

2017-09-19 20:45:41 292

原创 poj_2406_kmp_入门_精华操作_解释

kmp 得精华就是next数组; 很多博客瞎几把写,误人子弟, 1.今天队里一个oi选手,我询问他的训练计划,高一高二,星期天做三道题,写题解,很长,且三道题不能是水题; 还是年轻,很多灌水博客就是这样出现的吧,我遇见过几个大佬,他们一般写博客要么只发代码,要么很严谨,当然很重要的一点是简洁,的语言精确的描述, 2,还有就是刚写博客的小白,这个…..我也是过来人,感觉这个还是自

2017-09-19 19:34:58 773

原创 Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)

后续 一直更新 A一道更新一次 A 题 题意: 给你一个数n 让你乘一个数 然后尾部要有>=k个0 关键n在1e9范围 k<=8; 解: 开始只想到2*5 ,好来wa,直接就1e6暴力吧,竟然31ms抖过#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){

2017-09-18 09:28:57 398

原创 poj_1995_快速幂_水

#include<iostream>#include<cstdio>typedef long long ll;using namespace std;ll solve (ll a,ll b,ll mod){ ll ans=1; a%=mod; while(b) { if(b&1) ans=ans*a%mod;

2017-09-16 11:48:06 215

原创 矩阵快速幂基础知识补充_关联斐波那契数列通项公式

fibonacci公式:对公式取对数:

2017-09-16 08:53:16 327

原创 hdu_1588_矩阵_求和_乘法_快速幂_斐波那契数列求前n项和

Sample Input 2 1 4 100 2 0 4 100 Sample Output 21 12 Source 题意 ;给你斐波那契数列 F(x); 给你x= g(i)的函数; 让你求 i从0到n-1所有斐波那契数列的和; 解: g(i)=ki+b; 由之前的矩阵快速幂知识可知 F(X)=A^x; A是矩阵 1 1

2017-09-16 08:52:08 659

原创 poj_1845_ 求所有a^b的所有因子和

SumdivConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natu

2017-09-15 09:33:35 669

原创 矩阵快速幂模板

#include <cstdio>#include <iostream>using namespace std;const int MOD = 10000;struct matrix{ long long m[2][2];}ans, base;matrix multi(matrix a, matrix b){ matrix tmp; for(int i = 0; i

2017-09-14 19:53:43 138

原创 hdu_6186_前缀后缀_水_死于英语

CS Course Little A has come to college and majored in Computer and Science.Today he has learned bit-operations in Algorithm Lessons, and he got a problem as homework.Here is the problem:You are giving

2017-09-12 22:02:24 322

原创 hdu_2795_线段树入门_线段树由树状数组转坑原本数组模拟

**BillboardAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are posted

2017-09-12 19:59:27 227

原创 poj_2366_标准二分

Sacrament of the sum— The Brother of mine, the Head of Monastic Order wants to know tomorrow about the results long-term researches. He wants to see neither more nor less than the Summering Machine! Ev

2017-09-08 10:44:56 413

原创 poj_1061_终于理ex_gcd正解的正确求法_结果要mod(b%gcd)

青蛙的约会两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观

2017-09-07 21:02:37 168

原创 hdu_1060_数学求解n^n的第一位数

Leftmost DigitGiven a positive integer N, you should output the leftmost digit of N^N.InputThe input contains several test cases. The first line of the input is a single integer T which is the number

2017-09-06 21:59:32 277

原创 poj_2142_欧几里得扩展解延伸_理解过程紧张刺激

The BalanceMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put

2017-09-06 20:16:16 163

原创 hdu_5512_找规律

Pagodasn pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1≤a≠b≤n) withstood the

2017-09-06 10:58:32 213

原创 hdu_1222_欧几里得_gcd简单应用_欧几里得扩展性质

Wolf and RabbitThere is a hill with n holes around. The holes are signed from 0 to n-1.A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get i

2017-09-04 10:53:22 245

原创 hdu_1576_包含数学变形的扩展欧几里得

A/B 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input 数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。 Output 对应每组数据输出(A/B)%9973。 Sample Input 2 1000 53

2017-09-04 09:51:05 160

原创 hdu_2669_扩展欧几里得_first_blood

RomanticPrev Submit Status Statistics Next The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Trees Trees are Shaking, Leaves are Falling. Lovers Walk passing,

2017-09-03 21:42:15 196

原创 hdu_2647_拓扑排序_邻接表或者vector_优化内存_拓扑+贪心_用的是拓扑思想_并不是拓扑

RewardDandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewards.The workers will com

2017-09-02 16:07:37 263

空空如也

空空如也

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

TA关注的人

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