努力ing
你浪费的今天是昨天死去的人所渴望的明天!!!

http://acm.hdu.edu.cn/showproblem.php?pid=4552

dp

#include<iostream>

#include<string>
using namespace std;
int main()
{
	string str;
	int i,j,k;
	while(cin>>str)
	{
		int count=0;
		int t=str.length();
		for(i=0;i<t;i++)
		{
			for(j=0,k=i;j<t;j++,k++)
			{
				if(str[j]!=str[k])
					break;
			}
			count+=j;
		}
		cout<<count%256<<endl;
	}
}

 

posted on 2013-06-01 10:52  努力ing  阅读(127)  评论(0)    收藏  举报