1093. Count PAT's (25)
来源:互联网 发布:淘宝钻展在哪里展示 编辑:程序博客网 时间:2024/04/28 23:55
1093. Count PAT's (25)
时间限制
120 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CAO, Peng
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.
Now given any string, you are supposed to tell the number of PAT's contained in the string.
Input Specification:
Each input file contains one test case. For each case, there is only one line giving a string of no more than 105 characters containing only P, A, or T.
Output Specification:
For each test case, print in one line the number of PAT's contained in the string. Since the result may be a huge number, you only have to output the result moded by 1000000007.
Sample Input:APPAPTSample Output:
2
#include <stdio.h> #include <stdlib.h> int main() { char c;int PCount,PACount,PATCount;PCount = 0;PACount = 0;PATCount = 0;while( (c=getchar())!='\n'){if(c == 'P'){PCount = PCount+1;}if(c == 'A'){PACount = PACount+PCount;}if(c == 'T'){PATCount = (PATCount + PACount)%1000000007;}}printf("%d",PATCount);//system("pause"); return 0; }
0 0
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- 1093. Count PAT's (25)
- [Leetcode] Counting Bits
- 二叉树中序遍历成双向链表
- 51nod 1405 树的距离之和(树型dp)
- 二叉树的深度优先遍历与广度优先遍历 [ C++ 实现 ]
- java中基本数据类型的初始化默认值
- 1093. Count PAT's (25)
- 安卓入门-UI 之自定义actionbar样式
- 使用BeautifulSoup爬取github内容示例
- <boost-03>如何使用boost filesystem获取给定子文件夹的目录?how to use boost filesystem to get subfolders?
- 自动化生成 Openstack 新项目开发框架
- requestAnimationFrame的动画循环
- 直方图均衡化的数学原理
- [美剧赏析] 权力的游戏<Game of Thrones>完全赏析 (51-52)
- LeetCode Self Crossing