Ayoub thinks that he is a very smart person, so he created a function f(s)f(s) , where ss is a binary string (a string which contains only symbols "0" and "1"). The function f(s)f(s) is equal to the number of substrings in the string s…
最近网课也开始了,牛客上一堆比赛题目也没补,所以就D题后面的也懒得补了 A.Three String 水题 #include <cstdio> #include <cstring> using namespace std; ], b[], c[]; int main() { int t; scanf("%d", &t); while (t--) { memset(a, , sizeof(a)); memset(b, , sizeof(b)); memse…
A. Three Strings 题意:给三个长度相同的非空字符串abc,依次将c中的每个字符和a或者b中对应位置的字符进行交换,交换必须进行,问能否使得ab相同. 思路:对于每一个位置,如果三个字符都不相同,那一定不同,如果有两个相同且不是ab相同,则合法,否则不合法,如果三个字符都相同,那么合法. #include<bits/stdc++.h> #define LL long long #define dl double void rd(int &x){ x=;;char ch=g…
D. Tricky Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/429/D Description Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The sele…
A. Calculating Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/486/problem/A Description For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn Your task is to calculate f(n) for a…
题目链接:www.codeforces.com/problemset/problem/486/A题意:求表达式f(n)的值.(f(n)的表述见题目)C++代码: #include <iostream> using namespace std; long long f(long long n) { == ) ; else - n; } int main() { long long n; cin >> n; cout << f(n) << endl; ; } C…
Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn Your task is to calculate f(n) f…
A. Calculating Function   For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn Your task is to calculate f(n) for a given integer n. Input The single line contains the positive integer n (1 ≤ n ≤ 1015). Output Print…
题:https://codeforces.com/contest/1301/problem/E 题意:给个n*m的图形,q个询问,每次询问问询问区间最大的合法logo的面积是多少 分析:由于logo是由4个同色的小正方形组成的,所以我们先考虑一个数组val[i][j]表示[i][j]位置为‘R' , [i+1][j]位置为’Y‘,[i][j+1]位置为’G‘,[i+1][j+1]位置为’B'所能形成的最大图案边长是多少: 因为这样就只要预处理‘R’正方形沿着左上能形成的最大正方形,“Y”沿着左下…
先把一种最长路线记录下来,根据k的大小存到ans中相应的答案再输出 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; vector<char>vv; vector<pair<int,char>>ans; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m,…