another

杭电oj3306:Another kind of Fibonacci(矩阵快速幂)

可紊 提交于 2020-01-30 00:09:07
Another kind of Fibonacci 题目链接 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description As we all known , the Fibonacci series : F(0) = 1, F(1) = 1, F(N) = F(N - 1) + F(N - 2) (N >= 2).Now we define another kind of Fibonacci : A(0) = 1 , A(1) = 1 , A(N) = X * A(N - 1) + Y * A(N - 2) (N >= 2).And we want to Calculate S(N) , S(N) = A(0) 2 +A(1) 2 +……+A(n) 2 . Input There are several test cases. Each test case will contain three integers , N, X , Y . N : 2<= N <= 2 31 – 1 X : 2<= X <= 2 31 – 1 Y : 2<= Y <= 2 31 – 1 Output For each test case , output the

Android Studio提交GIT时,Another git process seems to be running in this repository, e.g. an editor open

不羁的心 提交于 2020-01-24 04:53:17
Android Studio提交GIT时,报异常如下: File exists . Another git process seems to be running in this repository , e . g . an editor opened by 'git commit' . Please make sure all processes are terminated then try again . If it still fails , a git process may have crashed in this repository earlier : remove the file manually to continue . 解决方案: 在项目的根目录,也是.git的所在目录执行(Android Studio Terminal 执行): rm -f .git/index.lock 来源: CSDN 作者: 微信号 lanjixingxun 链接: https://blog.csdn.net/LXFX1108/article/details/103988953

1745. Yet Another Answer

梦想的初衷 提交于 2020-01-23 04:38:18
http://acm.timus.ru/problem.aspx?space=1&num=1745 题目大意: 可以是任意的顺序,在满足括号匹配的情况下,求组合成的字符串长度最长 思路: 先将每一个字符串进行处理,处理时将匹配的去掉 比如说 { )(()(())(} 处理后就变成了 {)( (} 当然字符串的长度是没有变化的 处理后的字符串假如说 左括号的个数为L 右括号的个数为R 我们必须确定一个正确的顺序,可以让我们从头到尾的逐个决定是否选用当前字符串,而且不影响最优结果 字符串有 L>R,L<R 和 L=R 三种情况,对于L>R的字符串要放在前面 因为每一个这样的字符串都可以使 左括号 — 右括号 的值变大, 而对于 L<R 的情况对应放在最后,L=R的情况放在中间 对于L<R的字符串之间 需要把 R 小的放在前面, 对于L>R的情况 要用对称思想去确定顺序 确定顺序之后,剩下的就DP就可以了 代码: #include<iostream> #include<stack> #include<cstdio> #include<queue> #include<cstring> #include<algorithm> #include<vector> #include<set> #include<map> #include<string> #include<cmath> using

B. Yet Another Crosses Problem

妖精的绣舞 提交于 2020-01-23 04:35:51
B. Yet Another Crosses Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a picture consisting of n rows and m columns. Rows are numbered from 1 to n from the top to the bottom, columns are numbered from 1 to m from the left to the right. Each cell is painted either black or white. You think that this picture is not interesting enough. You consider a picture to be interesting if there is at least one cross in it. A cross is represented by a pair of numbers x and y , where 1 ≤ x ≤ n and 1 ≤ y ≤ m , such that all

Day8 - C - Another Problem on Strings CodeForces - 165C

不羁岁月 提交于 2020-01-22 18:48:30
A string is binary, if it consists only of characters " 0" and " 1". String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w . For example, string " 010" has six substrings: " 0", " 1", " 0", " 01", " 10", " 010". Two substrings are considered different if their positions of occurrence are different. So, if some string occurs multiple times, we should consider it the number of times it occurs. You are given a binary string s . Your task is to find the number of its substrings, containing exactly k characters " 1". Input The first

supervisord 启动失败 Error: Another program is already listening on a port that one of our HTTP serve...

本小妞迷上赌 提交于 2020-01-19 15:24:07
Linux系统中 Supervisor 配置守护进程: 启动Supervisor 服务语句: supervisord -c /etc/supervisor/supervisord.conf 这个过程可能会失败,错误如下:    解决办法: 执行下面语句 unlink /var/run/supervisor.sock unlink /tmp/supervisor.sock 这个错误的原因就是supervisor.sock 这个文件会被系统自动删除或者其它原因不存在了,删除软连接就可以了。 supervisor.sock 生成的位置可以去 supervisor 的配置文件中找到。 来源: https://www.cnblogs.com/wmyll/p/10615051.html

Codeforces Round #599 D Yet Another Monster Killing Problem

风格不统一 提交于 2020-01-18 13:58:53
机灵点的模拟。 首先是英雄的最优模拟的数组:第一天的最优力量、第二天的最优力量... ( 这样形成的就是一个偏序集合,复杂度O(n+m) ,因为耐力不是很大,所以可以ac) 其次是要维护一个rmq,否则会犯了比赛中的错误。 #include <bits/stdc++.h> using namespace std; const int maxn = 2e5+500; //要筛选出一个有用的偏序集合的时候,貌似是排序然后单调栈是最好理解的。 //在这题中,因为维度s的取值范围足够小,可以不进行排序而使用dp来进行转移, //具体做法就是在每个耐力值上打上最大的pi标记,然后从n向1传递pi, //这样形成的就是一个偏序集合,复杂度O(n+m)。 int a[maxn],b[maxn]; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin>>T; int n,m; while(T--){ cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; } cin>>m; //int p[maxn]; //p是力量数组,下标是耐力,值是力量,这样就可以扫一遍处理出各种英雄的使用情况 //利用了数组下标上升自动排序的特性 // memset(p, -1, sizeof(p)); vector

D. Yet Another Monster Killing Problem

冷暖自知 提交于 2020-01-17 05:24:14
http://codeforces.com/contest/1257/problem/D D. Yet Another Monster Killing Problem time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You play a computer game. In this game, you lead a party of 𝑚 heroes, and you have to clear a dungeon with 𝑛 monsters. Each monster is characterized by its power 𝑎𝑖. Each hero is characterized by his power 𝑝𝑖 and endurance 𝑠𝑖. The heroes clear the dungeon day by day. In the beginning of each day, you choose a hero (exactly one) who is going to enter the dungeon this day. When the hero enters the dungeon, he

Educational Codeforces Round 80 (Rated for Div. 2) B

♀尐吖头ヾ 提交于 2020-01-16 03:50:55
B. Yet Another Meme Problem 传送门 # include <stdio.h> int main ( ) { int t ; for ( scanf ( "%d" , & t ) ; t -- ; ) { long long n , d , c = 0 , t = 9 ; scanf ( "%lld %lld" , & n , & d ) ; while ( t <= d ) { static_cast < void > ( c ++ ) , t = t * 10 + 9 ; } printf ( "%lld\n" , n * c ) ; } return 0 ; } 来源: CSDN 作者: king9666 链接: https://blog.csdn.net/king9666/article/details/103996271

Codeforces 1257D - Yet Another Monster Killing Problem

本秂侑毒 提交于 2020-01-15 09:00:41
题意 : 有 \(n\) 个怪物,每个怪物有攻击力 \(a_i\) 点;有 \(m\) 个英雄,每个英雄有攻击力 \(p_i\) 点,耐力 \(s_{i}\) 点。 怪物需要被依次杀死(按输入顺序)。 每一天可以挑选一个英雄去杀怪物,他可以杀死的怪物攻击力小于等于他本身(即 \(a\leq p\) ),每天最多可以杀死 \(s\) 个怪物。(每个英雄可以使用任意次) 问最少需要多少天可以杀死所有怪物(不能则输出 \(-1\) )。 分析 : \((1)\) 我们找到怪物的最大攻击力和英雄的最大攻击力,判断是否要输出 \(-1\) 。 \((2)\) 将英雄按攻击力 \(p\) 值排序,我们可以发现对于英雄 \(b[i]\) 而言,如果对于 \(i<j\leq m\) ,且有 \(b[i].s<b[j].s\) ,我们可以选择英雄 \(j\) ,而不是英雄 \(i\) ,那么我们可以把 \(b[i].s\) 替换为 \(b[j].s\) (意思为选择英雄 \(i\) 时选择英雄 \(j\) )。 \((3)\) 因此我们进行后缀操作将 \(b[i].s\) 改为英雄 \(i\) ~ \(n\) 中最大的耐力值,以便进行下一步。 \((4)\) 对于某个怪物而言,我们可以找到一个英雄,他的攻击力刚好大于等于该怪物(二分)。我们上一步将该英雄的耐力改为了后缀最大值,那么我们便选择这个英雄