CodeForces - 357D - Xenia and Hamming】的更多相关文章

先上题目: D. Xenia and Hamming time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Xenia is an amateur programmer. Today on the IT lesson she learned about the Hamming distance. The Hamming distanc…
题目链接: B. Xenia and Hamming 题意: 要求找到复制后的两个字符串中不同样的字符 思路: 子问题: 在两串长度是最大公倍数的情况下, 求出一个串在还有一个串中反复字符的个数 CODE: #include <iostream> #include<stdio.h> #include<string> #include<string.h> using namespace std; #define M 1000006 int com[M][26]…
题目链接:http://codeforces.com/problemset/problem/342/B 题目意思:有n个spy,编号从1-n,从左到右排列.现在的任务是,spy s要把信息传递到spy f,但必须要满足:当spy li - spy ri 被观看时,这一段spy不能传递信息. 要注意的是,step数(也就是ti)不一定是按顺序排列下来的,它有可能与上一行的step相差好几轮.此时,这好几轮中,spy s 是可以继续往spy f的方向传递信息的,直到移动完这好几轮的数目为止.除此,有…
题目链接:http://codeforces.com/problemset/problem/342/A 题目意思:给出n个数,找出n/3个组且每组有3个数,这三个数必须要符合两个条件:1.a < b < c:2.b mod a = 0 和 c mod b =0.如果找不到,输出-1. 其实每组内只可能是这三组数的其中一组:1 2 4: 1 2 6: 1 3 6 以下注释部分读者可以直接忽略. /* 刚开始想得很复杂,三个数组分别存储初始数s,记录已输出的数 vis 还有经判断符合条件将要输出的…
题目链接:http://codeforces.com/problemset/problem/339/B 题目理解不难,这句是解题的关键 In order to complete the i-th task, she needs to be in the house number ai and complete all tasks with numbers less than i .从样例1的提示,可以知道,如果a[i] > a[i+1],则需要继续顺时针走下去,直到到达n,接着重新从1开始数,直…
http://codeforces.com/contest/357/problem/D 题意:给你两个数n和m,表示两个字符串的循环次数,然后给出两个字符串,求出其相同位置字符不同的个数. 先求出两个字符串长度的最大公约数和最小公倍数,然后求出在最小公倍数范围内的不同字符的个数,后面的和前面的一样,最终的个数也就求出了. #include <cstdio> #include <cstring> #include <algorithm> #define LL __int6…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Xenia and Bit Operations Xenia the beginner programmer has a sequence a, consisting of 2n non-negative integers: a1, a2, ..., a2n. Xenia is currently studying bit operations. To better unders…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Xenia and Weights Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud D. Xenia and Dominoes Xenia likes puzzles very much. She is especially fond of the puzzles that consist of domino pieces. Look at the picture that shows one of such puzzles. A puzzle is a 3 ×…
[题目链接] https://codeforces.com/problemset/problem/339/D [算法] 线段树模拟即可 时间复杂度 :O(MN) [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 18 << MAXN; int n , m; int a[MAXS]; struct SegmentTree { struct Node { int l , r; int value , d; }…