BestCoder Round #89 1001 /hdu 5944/ Fxx and string
来源:互联网 发布:域名在微信内禁止访问 编辑:程序博客网 时间:2024/06/02 01:49
Fxx and string
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 722 Accepted Submission(s): 315
Problem Description
Young theoretical computer scientist Fxx get a string which contains lowercase letters only.
The stringS contains n lowercase letters S1S2…Sn .Now Fxx wants to know how many three tuple (i,j,k) there are which can meet the following conditions:
1、i,j,k are adjacent into a geometric sequence.
2、Si= 'y ',Sj= 'r ',Sk= 'x '.
3.Either j|i or j|k
The string
1、
2、
3.Either j|i or j|k
Input
In the first line, there is an integer T(1≤T≤100) indicating the number of test cases.
T lines follow, each line contains a string, which contains only lowercase letters.(The length of string will not exceed 10000 ).
Output
For each case, output the answer.
Sample Input
2xyyrxxyyrrxxxxx
Sample Output
02
Source
BestCoder Round #89
Recommend
wange2014 | We have carefully selected several similar problems for you: 5960 5959 5958 5957 5956
..当时没考虑反过来的情况,大数据没过
枚举公比和首元素即可
#include<stdio.h>#include<string.h>char ch[10005];int main(){int t,n,i,j,k,ans;scanf("%d",&t);getchar();while(t--){ans=0;scanf("%s",ch+1);//printf("%s\n",ch+1);n=strlen(ch+1);//printf("%d",n);for(i=1;i<=n;i++){for(j=2;j*j*i<=n;j++){if(ch[i]=='y'&&ch[i*j]=='r'&&ch[i*j*j]=='x'){ans++;}else if(ch[i]=='x'&&ch[i*j]=='r'&&ch[i*j*j]=='y'){ans++;}}}printf("%d\n",ans);}return 0;}
0 0
- BestCoder Round #89 1001 /hdu 5944/ Fxx and string
- BestCoder Round #89 1001 Fxx and string
- BestCoder Round #89 1001 /hduoj 5944/Fxx and string
- HDU 5944 Fxx and string && BestCoder Round #89 1001(细节)
- BestCoder Round #89 1001 & HDU 5944 Fxx and string【字符串,等比数列】
- bestcoder-Fxx and string
- [BestCoder Round #89]Fxx and tree
- hdu 5944 Fxx and string
- hdu 5944 Fxx and string
- HDU 5944 Fxx and string
- hdu 5944 Fxx and string
- HDU 5944 Fxx and string
- hdu 5944 Fxx and string
- hdu 5944 Fxx and String 暴力(水)
- hdu 5944 Fxx and string【暴力枚举】
- 【HDU 5944 Fxx and string】+ 优化
- 【hdu 5944】Fxx and string(枚举)
- HDU 5944 Fxx and string(数学)
- ActiveMQ的发布订阅模式
- STS 或 eclipse velocity插件安装
- 数据库的乱码问题及数据库与程序的连接
- 网络编程基础---------陈Hong鑫
- Objective-C 中如何测量代码的效率
- BestCoder Round #89 1001 /hdu 5944/ Fxx and string
- 创建Fragment
- UVA 439 BFS入门
- apache common logging和log4j区别
- Java回顾之一些基础概念
- C语言99乘法表程序
- Fox and Number Game(优先队列)
- Why always OpenCV Error: Assertion failed (elements_read == 1) in unknown function ?
- 三大数据库区别介绍