Avito Cool Challenge 2018】的更多相关文章

Codeforces Avito Code Challenge 2018 D. Bookshelves 题目连接: http://codeforces.com/contest/981/problem/D Description Mr Keks is a typical white-collar in Byteland. He has a bookshelf in his office with some books on it, each book has an integer positive…
考挂了.. A - Definite Game 直接看代码吧. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<map> #include<vector> #include<cmath> #include<cctype> using namespace std;…
A. Definite Game: 题意:输入N,输出最小的结果N-x,其中x不少N的因子. 思路:N=2时,输出2:其他情况输出1:因为N>2时,N-1不会是N的因子. #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; ; int a[maxn]; int main() { int N; cin>>N; ) puts("); "…
第一次打CF,很菜,A了三道水题,第四题好像是是数位DP,直接放弃了.rateing从初始的1500变成了1499,还是绿名,这就很尴尬.之后觉得后面的题目也没有想象的那么难(看通过人数)过两天吧剩下的五题给补上. http://codeforces.com/contest/981 A:给你一个字符串S,求把这个字符串中的最长不回文子序列. 思路: 如果S不回文,那就是本身 如果S回文: (1)如果S由一种字母构成,那么最长不回文子序列为空,因为无论删除多少个都是回文串. (2)如果S不是上述情…
A:n==2?2:1. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long ')) c=getchar();return c;} ?n:gcd(m,n%m);} int read() { ,…
A. Definite Game 签. #include <bits/stdc++.h> using namespace std; int main() { int a; while (scanf("%d", &a) != EOF) { [](int x) { ; i >= ; --i) if (x % i) { printf("%d\n", x - i); return; } printf("%d\n", x); }(…
传送门:http://codeforces.com/contest/1081/problem/E E. Missing Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Chouti is working on a strange math problem. There was a sequence of nn …
传送门:http://codeforces.com/contest/1081/problem/C C. Colorful Bricks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his free time, Chouti likes doing some housework. He has got one new…
传送门:http://codeforces.com/contest/1081/problem/B B. Farewell Party time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Chouti and his classmates are going to the university soon. To say goodbye…
题目链接 题意 : 给出一个联通图和一些特殊的点,现在定义cost(u,v)为一条从u到v的路径上面边权的最大值 , 定义dis(u,v) 为从u到v 路径上面cost 的最小值 然后求所有特殊点到其他特殊点的最大距离 题解: 做这题前,首先思考一件事情,对于一颗树来说点到点的距离是不是就是树上面路径的边权最大值 我们来证明一下:假设在最小生成树上面的路径cost为w1,另外在原图中还有一条路径从u到v,其cost为w2,那么必然有w2>w1的.那么我们最后的dis一定是w1. 那么我们现在的目…