当前位置: 代码迷 >> PHP >> http://acm.hdu.edu.cn/showproblem.php?pid=1020大水题一个疑惑释
  详细解决方案

http://acm.hdu.edu.cn/showproblem.php?pid=1020大水题一个疑惑释

热度:505   发布时间:2016-04-29 00:24:31.0
http://acm.hdu.edu.cn/showproblem.php?pid=1020大水题一个不解释
#include<string>#include<cstdio>#include<map>#include<algorithm>#include<string.h>#include<cmath>#include<iostream>using namespace std;int main(){ int t; scanf("%d",&t); string str;  while(t--)  {	  map<char,int>M;       cin>>str;	for(int i=0;i<str.size();i++)	{	  char p=str[i];	  int kk=0;	  while( ++i < str.size() && p==str[i] )kk++;	  i--;	  if(kk==0)	  {	   printf("%c",p);	  }else	  {	  printf("%d%c",kk+1,p);	  }	}	printf("\n");  }	return 0;}

  相关解决方案