include<stdio.h> include<string.h> intmain() { inti,j,k; intn; intt; chargo[10000]; scanf("%d",&t); while(t--) { scanf("%s",go); n=strlen(go); intans=1; for(i=1;i<n;i) { for(j=0;j<n;j) { if(go[j]!=go[(i+j)%n]) break; } if(jn) ans; ...

  W79oLdECuAdO   2023年11月12日   19   0   0 inputoutputeachstringgo

include<stdio.h> intmain() { inti,j,k; inta,b; intt; scanf("%d",&t); while(t--) { scanf("%d",&a); b=a+1; k=a^b; j=0; while(k) { j+=k&1; k=k>>1; } printf("%d\n",j); } return0; } K TimeLimit:1000msMemoryLimit:65536kBSolved:122Tried:173 Descr...

  W79oLdECuAdO   2023年11月12日   21   0   0 inputoutputeachintegerMemory

//没有想仔细,,WA了几次。还好, include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<math.h> include<string> include<stdlib.h> include<list> inclu...

  W79oLdECuAdO   2023年11月12日   24   0   0 inputoutput#include游戏测试

include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<math.h> include<string> include<stdlib.h> include<list> include<vector> usi...

  W79oLdECuAdO   2023年11月12日   24   0   0 input存储output工具测试

又一简单题,,一次过了, include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<math.h> include<stdlib.h> include<list> include<vector> usingnamespa...

  W79oLdECuAdO   2023年11月02日   46   0   0 iniinputintegeroutputList

嗯嗯 include<stdio.h> include<string.h> include<iostream> include<algorithm> usingnamespacestd; defineN1011 structmy { intfrom; intto; } go[300]; boolcmp(mya,myb) { if(a.from!=b.from) returna.from<b.from; returna.to<b.to; } intmain() { freopen("fuck.txt","r",...

  W79oLdECuAdO   2023年11月02日   62   0   0 managerinputGoeachtable

从一点开始最多能到多少个满足条件的.从开始点这样的搜索就行, include<stdio.h> include<algorithm> include<iostream> include<cmath> usingnamespacestd; intgo[1000000]; intmain() { inti,j,k; intt; intn; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&k); for(i=1;i<=n;i) scanf(...

  W79oLdECuAdO   2023年11月02日   38   0   0 inputintegerGooutputeach

include<iostream> include<cstdio> include<cstring> include<ctype.h> include<vector> include<algorithm> usingnamespacestd; intans; intn,m; intgo[111][111]; voiddfs(intcen,intdays,intsum)//这种方法太超时了 { //cout<<cen<<''<<days<<''<<sum&...

  W79oLdECuAdO   2023年11月02日   40   0   0 input64bitGomatrixoutput

题意:有N个农场,M条路连通他们(只是单向的)       现在有K头牛在一些农场上,      求所有牛能到达的农场个数。 思路:就是对于每头牛单独地DFS,最后逐个检查每个农场牛到的头数。 include<iostream> include<vector> usingnamespacestd; intk,n,m; vector<int>v[1001]; intat[101]; boolb[1001]; intsum[1001]; ...

  W79oLdECuAdO   2023年11月02日   41   0   0 ios#includeci

题意: 在一个由男生和女生组成的队中,每一秒如果一个男生在一个女生的前面, 他们就会互换位置。求女生全换到最前面用的最少时间。 DP转移方程: ans=max(ans+1,pre); pre是从后往前到当前位置时的女生数         意思是在当前如果是男生并且该 男生后面有女生的存在,则选取 include<iostream> include<algorithm> include<cstring> include<string> usingnamespacestd; intmain() { freopen("in.txt"...

  W79oLdECuAdO   2023年11月02日   25   0   0 ios#includeci

感觉只有CDOJ才会出这样坑爹的题,,,---数字只有一位,不是多位的。其实是一道简单题 include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<math.h> include<stdlib.h> include<list> in...

  W79oLdECuAdO   2023年11月02日   125   0   0 i++inputGo#include测试

给出一个数,求这样的一个数给分解成各种大于1的数相乘的总数。 include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<stack> include<math.h> usingnamespacestd; intn; intgo[1000]; intl; inthi[1000]; intans; voidmake(intk,i...

  W79oLdECuAdO   2023年11月02日   26   0   0 i++iosGo#include

今天再做了一道树形DP的题,,在不知道DP之前这个题当时抓破了脑袋也没有出来。 题意:有N个具有特定的连通关系的点,如果安排一个兵在一个点上,则在该点还有其邻点上都被监视着      为了使整个网络内都能够被监视,则最少需要多少个士兵。 思路:就是找出满足相邻两边不能同时有兵士时的最大数量,然后用N减去这样的最大数就可以了 误区:我开始就这样想的,可是做对了才想起这个理论没有考虑成熟就做了,幸好还对了。 难点:其输入些许麻烦,对输入的处理要小心,不然一不小心就错了。 include<iostream> include&...

  W79oLdECuAdO   2023年11月02日   31   0   0 ci#includeide

这个题是P1011stick的简单版,以前都是参考着别人的代码才AC的、。 今天我就费了很多的时间,一直以为自己是对的,然后看了一下我以前写的, 发现自己存在着一个误区:一个边一个边的搜索到。其实要全部一直才可以的。    因为这里的组合不是想像中的那么的简单。 注意:在变量比较多的时候还是要把变量写得明确一点,不要为了节约一点时间而浪费更多时间。 include<stdio.h> include<string.h> include<iostream> include<algorithm> usingnames...

  W79oLdECuAdO   2023年11月02日   60   0   0 joinoutputeachinputinteger

这个计算需要对其优化提速,不然会严重超时的。 具体看代码吧。 然后遇到的问题是自己打的英文可能有错,就一直WA,然后我一个个的把题目中的英文复制进来提交,OK。 虽然交了很多次才成功,不过成功后挺爽的。 include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<m...

  W79oLdECuAdO   2023年11月02日   32   0   0 fileoutputeachinput优化

KMP算法的预处理部分.,,对计算到的第每一个序列进行比较,如果满足要求则输出(我是慢慢试出来的,) //H1358 include<iostream> include<stack> include<algorithm> include<time.h> usingnamespacestd; defineN1000010 intnext[N]; intn,m; chars[N]; voidput() { inti,j,k; for(i=0;i<=m+1;i) { cout<<next[i]<<''...

  W79oLdECuAdO   2023年11月02日   45   0   0 outputcharacterinputstringeach

include<iostream> include<stdlib.h> include<math.h> include<stdio.h> include<algorithm> include<queue> include<string.h> include<stack> include<math.h> usingnamespacestd; intmain() { inti,j,k; longgo[1001]; longhi[1001]; longmaxnum; intn; wh...

  W79oLdECuAdO   2023年11月02日   26   0   0

做出很久以前没有做出来的题的感觉真爽。 题意:判断是否是树,满足条件(1、只有一个根;2、每一个儿子只有一个父亲;3、不能自己是自己的父亲;4、两父子不能重复) 思路:用并查集记录每一个点的父亲。 特别注意:如果有圈,普通的并查集会出现打圈,死循环(现象是:MemorryExceeded) 解决方法:用rank[]记录每一个结点记录大概当了多少次父亲 include<iostream> include<algorithm> usingnamespacestd; //freopen("C://i.txt","r",stdin); defineN10001...

好不容易,,直接用DFS,,DIJ,,BFS都不行,,还得先处理一下,用VECTOR,然后效率才会提上去,,,呜呜,,学到了, include<string.h> include<iostream> include<stack> include<algorithm> include<time.h> include<queue> include<cstdio> usingnamespacestd; intn,m; intmap[1001][1001]; intv; boolans; intto; boo...

题意:给定有几种颜色,然后给定相应颜色的需求,然后给定灰色颜色的要求。              其中,灰色可以用随意的三种不同颜色的体积分别为m,m,m来合成灰色的颜料的体积为m。 做法:先找到每个颜色要求的量。再用灰色的量一个一个降低。如果该量不够,就再加一套颜料 include<iostream> include<cstdio> include<algorithm> include<queue> incl...

关注 更多

空空如也 ~ ~

粉丝 更多

空空如也 ~ ~