随笔分类 - codeforces
摘要:A. Cows and Primitive Rootstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe cows have just learned what a primitive root is! Given a primep, a primitive rootis an integerx(1 ≤ x #include #include #include #include #include #include usi...
阅读全文
摘要:B.Painting Eggs题目大意是:J画了n个鸡蛋,分别可以买给A 和G,对于每个鸡蛋A 和G的出价都不同,但是要求,最后卖给A 和G 两人鸡蛋的差价不超过500;/* 题目很水,当时没看懂,所以没做出来,导致又扣了57分;o(︶︿︶)o 唉 要是每次的题目都是中文题就好了,这也应该是很多做codeforces 的中国学生的期待吧; 英语这块软肋怎么办呢。。。*/贪心:#include #include #include #include #include #include #include #define maxn 1000010 char str[maxn];
...
阅读全文
摘要:C. XOR and OR题目大意:有两个字符串,a和b;由0 和 1组成,保证不为空;变化规则,1。可以不变 2。从字符串中选择两个字符,两种操作xor 和or;(^ and ||);问是否能将两个字符串互相变化;通过xor 和or 的规则我们可以发现,01可以变为11,11可以变为01或者10,唯独不能变的就是从11变成00;所以,如果a或b其中一个只包含0不包含1,则无法转换,否则可以转换;(当然,如果a、b长度不一样,毫无疑问NO);开始写的代码比较繁琐,我一步一步精简了,思想没变;代码一:#define maxn 1000100
char a[maxn],b[maxn];
using
阅读全文
摘要:http://codeforces.com/contest/278/problem/B/**题目:字符串数目n 1≤n≤30,每个字符串的长度不超过20*含有两个字符的字符串有676种,大于600,*所以不是它的子串的字符串在两位中就产生了*多谢大牛指点。。。*/#include #include #include #include using namespace std; char str[22];
bool s[26],ss[26][26]; //存放结果为一个字母、两个字母的情况 int main()
{ int n; cin>>n; while(n--) {
...
阅读全文

浙公网安备 33010602011771号