
弱鸡的日常
文章平均质量分 73
做不完的ACM
加油,努力
展开
-
CCPC哈尔滨补题
11月11号晚上补得题目, 没有及时发博记录,还是自己太懒了。D。X--MEN题意:给一棵n个节点的树(边劝都为1),k个人在树上不同位置,每个人以每秒1m向其他距离大于1的人移动,问所有人距离都小于等于1m的期望时间,比赛的时候无从下手,后来有个神TM的结论,期望次数取决于树上最远的2个人距离floor(d/2)。O(N)跑2下DFS就行。F。Permutation水题,很显然的原创 2017-11-12 14:01:44 · 364 阅读 · 0 评论 -
Codeforces 710C Magic Odd Square
题目链接:http://codeforces.com/problemset/problem/710/CC. Magic Odd Squaretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFind an n × n matrix ...原创 2018-04-07 12:44:57 · 267 阅读 · 0 评论 -
第十六届金马五校 二进制找规律F:1 + 2 = 3 ?
链接:https://www.nowcoder.com/acm/contest/91/F来源:牛客网小Y在研究数字的时候,发现了一个神奇的等式方程,他屈指算了一下有很多正整数x满足这个等式,比如1和2,现在问题来了,他想知道从小到大第N个满足这个等式的正整数,请你用程序帮他计算一下。 (表示按位异或运算) 输入描述:第一行是一个正整数,表示查询次数。接着有T行,每行有一个正整数,表示小Y...原创 2018-04-16 21:16:03 · 244 阅读 · 0 评论 -
牛客练习赛4B思维
链接:https://www.nowcoder.com/acm/contest/16/B来源:牛客网题目描述FST作为小朋友,经常会遇到和距离有关的问题,但是他已经厌倦了曼哈顿距离和欧几里德距离,所以FST就定义了一种FST距离。 这种距离并不用于空间或平面中,而运用于FST发明的一些神奇的算法中(唔... ...)。 设i号元素的特征值为Ai,则i和j的FST距离是 |i2 - j2|+|Ai2...原创 2018-03-27 12:43:32 · 430 阅读 · 0 评论 -
Codeforces 957C二分
题目链接:http://codeforces.com/problemset/problem/957/CC. Three-level Lasertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn atom of element X can exi...原创 2018-03-27 12:16:59 · 511 阅读 · 0 评论 -
Codeforces 365C 思维或二分
C. Matrixtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a string of decimal digits s. Let's define bij = si·sj. Find in matrix b ...原创 2018-03-15 23:43:31 · 241 阅读 · 0 评论 -
(2种状态最短路)nuboj 2473
题目链接:http://www.nbuoj.com/v8.8/Problems/Problem.php?pid=2473题意:中文题题解:见代码,注意初始建边。#include <bits/stdc++.h>using namespace std;#define pb push_back#define Pii pair<int,int> // first d...原创 2018-03-08 01:55:55 · 363 阅读 · 0 评论 -
Codeforces946E Largest Beautiful Number
题目链接:http://codeforces.com/contest/946/problem/E题意:给出一个数字找出第一个比他小的数,且其长度为偶数,并且可以构成回文。题解:1:首先长度为奇数时,直接输出(N-1)个9。 2:长度为偶数时,枚举答案串和输入串的lcp,对lcp的下一位进行枚举,然后判断是否合法。#include <bits/stdc++.h>us...原创 2018-03-07 17:03:35 · 376 阅读 · 0 评论 -
HihoCoder1683模拟
题目链接:http://hihocoder.com/problemset题解:枚举行数,然后随便模拟下。#include using namespace std;const int N = 10007;using ll = long long ;using ld = long double ;#define ALL(X) begin(X), end(X)#define mp原创 2018-01-15 00:45:04 · 149 阅读 · 0 评论 -
11.26补坑
#include using namespace std;#define rep(i,j,k) for(int i=(j);i<=(k);i++)#define pb push_back#define mem(a,k) memset(a,k,sizeof(a))#define mp make_pairtypedef pair P;const int N = 1E5 + 7,inf原创 2017-11-26 21:19:51 · 279 阅读 · 0 评论 -
Codeforces Round #450 (Div. 2)A
Problem A. Find Extra One链接:http://codeforces.com/contest/900/problem/A题意:给出平面内的n个点, 问是否可以移动其中一个点使其都在Y轴一侧。题解:直接判断左右两边的点数,确定是否可以。#include using namespace std;typedef long long ll;int main原创 2017-12-13 21:12:53 · 161 阅读 · 0 评论 -
CCPC.2017B.K-th Number
#include using namespace std;typedef long long ll;const int N = 1E5 + 7;int a[N], b[N], n, k;ll m;bool fuck(int x){ ll res = 0; int sum = 0, pre=1, last; for(last = 1;last <= n;las原创 2017-11-12 18:26:54 · 424 阅读 · 0 评论 -
Codeforces893E
题目链接:http://codeforces.com/problemset/problem/893/E题意:给出Q次询问,每次询问给出X,Y, 求有多少种长度为Y的序列满足其相乘得到X。如X=4,Y= 2可由以下6种得到:{ - 4, - 1}; { - 2, - 2}; { - 1, - 4}; {1, 4}; {2, 2}; {4, 1}.首先原创 2017-12-02 21:52:48 · 381 阅读 · 0 评论 -
ICPC2017北京现场赛H Puzzle Game
题目链接:http://hihocoder.com/problemset/problem/1634Time Limit:1000msCase Time Limit:1000msMemory Limit:256MBDescriptionOnce upon a time, there was a little dog YK. One day, he原创 2017-11-22 00:30:57 · 805 阅读 · 0 评论 -
Wannafly3位数差
题解:先整体考虑可以推出和顺序无关,对于当前i考虑bit(a[i]+a[j])比bit(a[i])大一#include using namespace std;typedef long long ll;const int N = 1E5 + 7;ll bit(ll x){ if(!x) return 1; ll cnt = 0; while(x) {原创 2017-11-15 03:13:24 · 248 阅读 · 0 评论 -
11.17菜鸡的日常
状态极差,感觉遇到了问题。。。。牛客练习赛的B题:题目描述给你一棵树,最开始点权为0,每次将与一个点x树上距离输入描述:第一行两个数n和m第二行n-1个数,第i个数fa[i + 1]表示i + 1点的父亲编号,保证fa[i + 1]<i + 1第三行m个数,每个数x依次表示这次操作的点是x输出描述:输出一个数,即这m次操作的答案的hash原创 2017-11-18 13:18:35 · 317 阅读 · 0 评论 -
Codeforces 965D
题目链接:http://codeforces.com/contest/965/problem/DA lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l<w. Frogs can also jump on lengths short...原创 2018-04-26 23:27:19 · 359 阅读 · 0 评论