http://www.patest.cn/contests/pat-a-practise/1093

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:

APPAPT

Sample Output:

2

这道题是2015考研机试前的那个PAT的D题 http://www.patest.cn/contests/pat-a-101-125-1-2015-03-14

这道题很简单,所以考试结束后原英文题目放到了A中,中文版的也放到了B中    http://www.cnblogs.com/asinlzm/p/4440603.html

 #include<stdio.h>
#include<string.h> int main()
{
char str[];
gets(str); int istr=strlen(str);
long long numA=,numT=,numP=;
while(istr>)
{
istr--;
if('T'==str[istr]) numT++;
else if('A'==str[istr]) numA+=numT;
else numP+=numA;
} printf("%lld",numP%);
return ; }

最新文章

  1. 【Tomcat】解决Eclipse无法添加Tomcat Service问题
  2. 基于webpack使用ES6新特性(转载)
  3. BackTrack5-r3汉化
  4. Orchard搜索与索引
  5. 鼠标滚轮控制侧边div上下翻动效果
  6. 如何把TOMCAT 添加到服务中自动启动
  7. vim的Tab设置为4个空格
  8. codeforces 707D-(DFS+bitset)
  9. MySQL防注入[待续]
  10. Android ImageButton的背景(图片)大小
  11. Linux 将本地文件上传Linux服务器, 即ssh 命令上传本地文件
  12. 毕业回馈-89c51之定时器/计数器(Timer/Count)
  13. 由浅入深的讲述Get和Post的区别
  14. JavaScript Uncaught TypeError: Cannot read property &#39;value&#39; of null
  15. 【Teradata】磁盘碎片整理(ferret工具)
  16. [转载]WebService使用的一些总结
  17. 什么是SpringCloud
  18. 【转载】 大龄码农那些事——也谈996.ICU
  19. Swift5 语言指南(二十八) 高级运算符
  20. 如何将同一个APP中的不同activity在Recent(最近任务)中显示?

热门文章

  1. JNI/NDK开发
  2. 记录一下今天犯得错误,public static function init()写成了public function initialize()
  3. Anywhere 随启随用的静态文件服务器
  4. saltstack执行结果存储到MySQL
  5. spark_运行spark-shell报错_javax.jdo.JDOFatalDataStoreException: Unable to open a test connection to the given database.
  6. myeclipse编辑jsp页面卡
  7. ubuntu apache2 https
  8. UVALive - 6442
  9. lecture-7 递归
  10. CCflow6 的使用