题目链接: http://codeforces.com/problemset/problem/7/D D. Palindrome Degree time limit per test1 secondmemory limit per test256 megabytes 问题描述 String s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length…
D. Palindrome Degree 题目连接: http://www.codeforces.com/contest/7/problem/D Description String s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length are (k - 1)-palindromes. By definition, any string (ev…
题目链接:http://codeforces.com/contest/7/problem/D D. Palindrome Degree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output String s of length n is called k-palindrome, if it is a palindrome itself…
题目链接:https://codeforces.com/contest/55/problem/D 题目大意:给你一段区间[l,r],要求这段区间中可以整除自己每一位(除0意外)上的数字的整数个数,例如15,因为15既可以整除1也可以整除5,所以15符合要求. (1 ≤ li ≤ ri ≤ 9 ·1018). Examples input Copy 11 9 output Copy 9 input Copy 112 15 output Copy 2 解题思路:很明显的数位dp,首先我们可以想一个数…
http://codeforces.com/contest/133/problem/E 题目就是给定一段序列,要求那个乌龟要走完整段序列,其中T就是掉头,F就是向前一步,然后开始在原点,起始方向随意,要求输出能走到最远是哪里. 首先可以保证的是,他最远走的可以默认是向右走,因为,如果你说是向左走的话,我可以设置相反的开始face,就是开始的时候面向那里,从而得到相反的结论.所以就能得到向左走,是-1,向右走,是+1 那么从最终状态考虑, 最后肯定是走完了整段序列,然后改变了n次,face是那里还…
题目链接:http://codeforces.com/contest/132/problem/C C. Logo Turtle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A lot of people associate Logo programming language with turtle graphics. In…
C. Balance time limit per test 3 seconds memory limit per test 128 megabytes input standard input output standard output Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once he wrote a random…
C. Logo Turtle   A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward"…
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一个queen了,问你有多少种方案,能够得到n点 题解 其实只用考虑三种情况,都考虑一下就好了,实在不行就暴力枚举-- 代码 #include<bits/stdc++.h> using namespace std; int n; int main() { scanf("%d",&…
Codeforces Beta Round #62 A Irrational problem 题意 f(x) = x mod p1 mod p2 mod p3 mod p4 问你[a,b]中有多少个数满足f(x)=x 题解 显然直接带进去就好了-- 代码 #include<bits/stdc++.h> using namespace std; int main() { int p1,p2,p3,p4,a,b; scanf("%d%d%d%d%d%d",&p1,&am…