随笔分类 - 馄饨
摘要:题意:给你一个无向图,它的边要么是黑色要么是白色,且图上的每个点最多与两个黑边两个白边相连。现在,Demon将图分成两部分,一部分包含所有的黑边,另一部分包括所有的白边,给你白边图中度为0的点的数量w0,度为1的点数w1,度为2的点数w2,与黑边图中度为0的点数b1,度为1的点数b1,度为2的点数b...
阅读全文
摘要:这题说的是个了n个数字 然后 在L 和R 区间内的数字的排列有多少种方案,这里我们通过 将 这n长度的字符串 分成sqrt(n) 块然后 一个属性 他们的l 属于 那个快 以这个为第一关键字 ,然后 在按照R 为 第二个关键字,然后sort 每个查询区间我们知道 当L他们属于一块内的时候 , R 是...
阅读全文
摘要:这题需要我们计算 这个 因为n#include #include using namespace std;long long P[1000005],per[1000005];const long long mod=1000000007;int main(){ P[0]=1;per...
阅读全文
摘要:好恶心的题#include #include #include #include #include using namespace std;typedef __int64 ll;struct point{ ll word,priori;}P[50005];char T[8][100]={ {"A...
阅读全文
摘要:这题说的是给了数字的字符串 然后有n种的操作没次将一个数字替换成另一个字符串,求出最后形成的字符串的 数字是多大,我们可以逆向的将每个数推出来,计算出他的值和位数记住位数用10的k次方来记 1位就是10 2位就是100,这样是为了防止当位数很大的时候存不下这样可以直接的进行mod操作#include...
阅读全文
摘要:经过分析后的二分题目是Josnch星球是一个赌博之风盛行的星球。每个人一出生就有一定数额的钱,之后的所有收入只能由赌博获得(OMG,如果RP不好,输光了所有的 钱。。。)假设赌博公司的某场赌博有N个结果,每个结果能获得的赔率比分别是a[1],a[2]...a[N]。假设现在XXX有X块钱,问他选择怎...
阅读全文
摘要:这题说的是 给了n个点在圆 上 然后 i连 i+2 从i+2 开始连 i+4 然后 这样一直到某个点 已经被连过为止 如果还有的没有被连过 就从那个点开始 连 按照上面的规则 当 N大于6 的时候可以很简单的发现 num=N*5; 画出后就很容易发现 当n《=2 的时候是0 个 n=3 1 n=...
阅读全文
摘要:这题说的是给了 n个数然后又 k次 的交换任意位置的 数字的机会 计算最长的连续子序列的和这要撸 模拟整个 过程 并不能就是算最长的递增序列 如果只是 找最长的 和序列的 话 会存在 很多问题 在替换的时候 每一个决策 都影响着 下一个决策 这样 存在谁与谁替换 这样的状态有 200!种 那就枚举每...
阅读全文
摘要:/* 很好的字符串 比较方法 很多个字符串 组成的 数字 需要最大 然后 比较 a和b 是 比较a+b 和b+a 的大小*/#include#include#include#includeusing namespace std;struct point{ char str[100];}T[55];bool cmp(point A,point B){ int i,a=strlen(A.str),b=strlen(B.str); point C=A,D=B; for(i=0;iD.str[i]; } return true;}int main(){ int n,i; c...
阅读全文
摘要:/* 暴力 过了 要使得两半的 樱桃数目相等 去试每一个斜率 还好他这里要的是 A、B 都为正整数 这样范围就锁定在200*100 个点范围内*/#include #include #include using namespace std;struct point{ int x,y;}node[110];void solve(int num){ int i; for(int A=-100;A0)L++; if(d<0)R++; if(d==0) break; } if(L==num/2&&R==num/2&&i==num){ printf("%d
阅读全文
摘要:During each move the player can chooseall lines of the matrix where dwarf is not on the cell with candyand shout "Let's go!"这个 看成是 选其所有干行 我却看成是选其中 若干 行 水一下自己#include #include #include #include using namespace std;char map[1005][1005];int N[1005],L[1005];int main(){ int n,m; while(scanf
阅读全文
摘要:/* 坑了 把 重载的#include#include#includeusing namespace std;struct word{ char str[205]; bool operator ='A'&&str[i]='a'&&str[i]='a'&&str[i]<='z'&&i<L){ T[num].str[Len++]=str[i]; i++; } num++; }else i++; } sort(T,T+num); printf("%s\
阅读全文
摘要:/* 水题 体现出题目看不懂 额 */#include #include #include #include using namespace std;const int maxn=55;struct card{ char A,B; card(char a=0,char b=0){ A=a;B=b; } bool operator == (const card F){ if(A==F.A||B==F.B) return true; else return false; }};struct stac{ card T[maxn]; int t; void sclea...
阅读全文
摘要:/* 题目的大意是 给你 N 学生 然后 给前 K个学生编号了 给定的 号码 , 然后你按照 使得接下来学生 学号尽量小的 方法 从第 K+1个学生开始编号 每个号码 自然只能用一次, 解答 : 先将编好的号码排好序,排完后 记录他们之间的 空格数,进行二分查找 有三种情况 1、学生就在 1至K中 2、学生在 K+1 到 D(K个学生中编号最大的那个数) 3、学生在D以后 1、3 都很好求, 对于第二种计算 他距离 第K个 学生都少位 ,然后再 之前算好的空格中 安排他 我为何如此的弱 想了 一天...
阅读全文
摘要:/* 通过这题 学会了 两个词组 immediately to the left 是左邻的意思 immediately to the right 这个是右邻的意思*/#include #include#includeusing namespace std;const int maxn=50;int N[2][maxn];int DNA[10];char str[]={' ','.','x','W'};int main(){ int t; scanf("%d",&t); while(t--){ for(i
阅读全文
摘要:A -Macaw Baby Learns ComputerTime Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluSubmitStatusDescriptionProblem FMacaW Baby Learns ComputerThe newborn Macaw baby is learning computer now. But as the Macaw dad cannot afford much so he has bought a computer that supports only floating-poin
阅读全文

浙公网安备 33010602011771号