传递 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 42    Accepted Submission(s): 16 Problem Description 我们称一个有向图G是传递的,当且仅当对任意三个不同的顶点a,,若G中有 一条边从a到b且有一条边从b到c ,则G中同样有一条边从a到c.我们称图G是一个竞赛图,当且仅当它是一个有…
异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 19    Accepted Submission(s): 9 Problem Description 晨晨在纸上写了一个长度为N的非负整数序列{ai }.对于这个序列的一个连续子序列{al,al+1,…,ar }晨晨可以求出其中所有数异或的结果 alxoral+1xor...xo…
最大的位或 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 18    Accepted Submission(s): 17 Problem Description B君和G君聊天的时候想到了如下的问题.给定自然数l和r ,选取2个整数x,y满足l <= x <= y <= r ,使得x|y最大.其中|表示按位或,即C. C++.…
朋友 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description B君在围观一群男生和一群女生玩游戏,具体来说游戏是这样的:给出一棵n个节点的树,这棵树的每条边有一个权值,这个权值只可能是0或1. 在一局游戏开始时,会确定一个节点作为根.接下来从女生开始,双方轮流进行 操作.当一方操作时,他们需要先选择一个不为根的点,满足该点到其父亲的边权为1; 然…
最大的位或 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description B君和G君聊天的时候想到了如下的问题.给定自然数l和r ,选取2个整数x,y满足l <= x <= y <= r ,使得x|y最大.其中|表示按位或,即C. C++. Java中的|运算.   Input 包含至多10001组测试数据.第一行有一个正整数,表示数据的组数.…
异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description 晨晨在纸上写了一个长度为N的非负整数序列{ai}.对于这个序列的一个连续子序列{al,al+1,-,ar}晨晨可以求出其中所有数异或的结果 alxoral+1xor...xorar其 中xor表示位异或运算,对应C.C++. Java等语言中的^运算.小璐提出了M个询问,每个询问用…
传递 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)     Problem Description 我们称一个有向图G是传递的,当且仅当对任意三个不同的顶点a,,若G中有 一条边从a到b且有一条边从b到c ,则G中同样有一条边从a到c.我们称图G是一个竞赛图,当且仅当它是一个有向图且它的基图是完全图.换句 话说,将完全图每条边定向将得到一个竞赛图.下图展示的是一个有4个顶点…
扫雷 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 998    Accepted Submission(s): 289 Problem Description 扫雷游戏是晨晨和小璐特别喜欢的智力游戏,她俩最近沉迷其中无法自拔.该游戏的界面是一个矩阵,矩阵中有些格子中有一个地雷,其余格子中没有地雷. 游戏中,格子可能处于己知和未知的状态…
Equation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 92    Accepted Submission(s): 24 Problem Description Little Ruins is a studious boy, recently he learned addition operation! He was rewa…
Difference Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 62    Accepted Submission(s): 19 Problem Description Little Ruins is playing a number game, first he chooses two positive integers y an…
Kingdom of Obsession Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 49    Accepted Submission(s): 14 Problem Description There is a kindom of obsession, so people in this kingdom do things very…
Four Operations Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 22    Accepted Submission(s): 12 Problem Description Little Ruins is a studious boy, recently he learned the four operations!Now h…
Car Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25    Accepted Submission(s): 12 Problem Description Ruins is driving a car to participating in a programming contest. As on a very tight sche…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10    Accepted Submission(s): 3 Problem Description There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri,…
ArcSoft's Office Rearrangement Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3    Accepted Submission(s): 2 Problem Description ArcSoft, Inc. is a leading global professional computer photogra…
Four Operations Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 38    Accepted Submission(s): 18 Problem Description Little Ruins is a studious boy, recently he learned the four operations! Now…
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛:https://www.jisuanke.com/contest/1227 题目链接:https://nanti.jisuanke.com/t/26219 Rock Paper Scissors Lizard Spock Description: Didi is a curious baby. One day, she finds a curious game, which named Rock Paper Scissors Lizard…
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛:https://www.jisuanke.com/contest/1227 题目链接:https://nanti.jisuanke.com/t/26172 Clever King Description: In order to increase the happiness index of people's lives, King Y has decided to develop the manufacturing industry v…
A------------------------------------------------------------------------------------ 题目链接:http://202.197.224.59/OnlineJudge2/index.php/problem/read/id/1260 题解:随机 n 个数把矩阵补全成 n × n 的.那么就是要算伴随矩阵的第一行,也就是逆矩阵的第一列,高斯消元即可. 源码:(Q神写的高斯消元,先贴一下诶,待补) #include<cs…
题目描述 cc最近收到了好多礼物,对着满地大小不一的礼物,她想要一个包来装,于是dd就掏出了一个会说话的神奇背包给cc装礼物.cc为了一次性装尽可能多的礼物,于是跟这个背包定下了一个规则,对每个礼物,背包会给出它对这件礼物的喜爱程度,背包越喜欢这个礼物,它就会越开心,越开心,它就会扩大自己的容量.于是问题就变成了这样:每个礼物都有自己的体积ai,背包也会给出它对这些礼物的喜爱程度bi,并且为了方便cc计算,背包告诉cc,喜爱程度bi就是这件物体放进背包,背包后会扩大的体积.那么现在cc想知道,对…
若干年之前的一道题,当时能写出来还是超级开心的,虽然是个板子题.一直忘记写博客,备忘一下. 米勒拉判大素数,关于米勒拉宾是个什么东西,传送门了解一下:biubiubiu~ B. Goldbach 题目传送门 自己看题意吧,直接贴代码了. 代码: #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<al…
Description: There is a positive integer X, X's reversion count is Y. For example, X=123, Y=321; X=1234, Y=4321. Z=(X-Y)/9, Judge if Z is made up of only one number(0,1,2...9), like Z=11,Z=111,Z=222,don't consider '+'and '-'. Input: Input contains of…
Description: The elderly aunts always like to look for bargains and preferential merchandise. Now there is a shop carrying out group purchase promotion. Rules are as follows : There are r pieces of promotional items, and each item is only one. In the…
题目链接:https://ac.nowcoder.com/acm/contest/903/L 题意:给你 n * n的方阵,你可以从任意一个数字开始走,可以走上下左右四个方向,走过的数字会被拼合,拼合的数字没有前导0,问最小不能拼合出来的数字是多少? 思路:开始就认为是一道深搜题,后面自己想太多就没去试,醉了orz! 这题就是把每个数字作为起点开始搜索,把已经搜索过的数字进行标记,然后从0开始检索,输出第一个未出现的数字就是答案.搜索的话我代码是搜5位数的所有组合,事实上这道题搜索3位数的所有组…
题目链接:https://ac.nowcoder.com/acm/contest/903/B 题意: 给你 q,n,p,求 q1+q2+...+qn 的和 模 p. 思路:一开始不会做,后面查了下发现有个等比数列求和的快速幂公式,附上链接https://www.cnblogs.com/yuiffy/p/3809176.html AC代码: #include<cstdio> #include<iostream> using namespace std; long long mod;…
题目链接:https://ac.nowcoder.com/acm/contest/903/J 题意:给你 n 个舔狗和他喜欢的人,让你俩俩配对(只能和喜欢它的和它喜欢的),求剩下的单身狗数量. 思路:类似于拓扑排序,由入度最少的边开始配对,也就是被最少的舔狗喜欢的(甚至是没有).将已经配对的舔狗进行标记,更新入度后重新加入优先队列,最后用总数减去标记数就是答案了. 总结:一开始我的思路是对的呐,但是我太菜了,卡在没办法处理同时配对2个点和维护他们入度,看完别人的处理才发现自己是局限于找入度为0而…
传送门 E.sequence •题意 定义序列 p 中的 "good",只要 i 之前存在 pj < pi,那么,pi就是 "good": 求删除一个数,使得序列中 "good" 的个数最多: •题解 一个数 pi 对 "good" 的贡献有两个来源: ①pi 本身为"good",对答案的贡献为 1: ②删除 pi 后,i 之后的本来是 "good" 的数因为 pi 被删除而变成非…
题目代号:HDU 6154 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6154 CaoHaha's staff Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 777    Accepted Submission(s): 438 Problem Description "You shal…
Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migic tree, the tree has N nodes , in each node , there is a treasure, it's value is V[i], and for each edge, there is a cost C[i], which means every time…
Deleting Edges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 567    Accepted Submission(s): 210 Problem Description Little Q is crazy about graph theory, and now he creates a game about grap…