题目:http://codeforces.com/problemset/problem/265/C
这是一道只需简简单单的几行就解决,并不难、、、、、哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
看明白你就发现了,AC 了
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
char s[1000005];
while(scanf("%s",s+1)!=EOF)
{
int len = strlen(s+1);
for(int i = 1;i<=len;i++)
{
if(s[i] == 'r')
printf("%d\n",i);
}
for(int i = len;i>0;i--)
{
if(s[i] == 'l')
printf("%d\n",i);
}
}
return 0;
}
本文提供了一种简洁高效的解题思路来解答CodeForces平台上的265C题目。通过简单的字符串遍历,分别从前向后查找字符'r'的位置,从后向前查找字符'l'的位置,实现快速定位并输出。代码使用C++编写。
566

被折叠的 条评论
为什么被折叠?



