PAT (Advanced Level) Practise - 1093. Count PAT's (25)
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 ; }
PAT (Advanced Level) Practise - 1093. Count PAT's (25)的更多相关文章
- PAT (Advanced Level) Practise - 1094. The Largest Generation (25)
http://www.patest.cn/contests/pat-a-practise/1094 A family hierarchy is usually presented by a pedig ...
- PAT (Advanced Level) Practise - 1092. To Buy or Not to Buy (20)
http://www.patest.cn/contests/pat-a-practise/1092 Eva would like to make a string of beads with her ...
- PAT (Advanced Level) Practise 1004 解题报告
GitHub markdownPDF 问题描述 解题思路 代码 提交记录 问题描述 Counting Leaves (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 1600 ...
- PAT (Advanced Level) Practise - 1095. Cars on Campus (30)
http://www.patest.cn/contests/pat-a-practise/1095 Zhejiang University has 6 campuses and a lot of ga ...
- 1079. Total Sales of Supply Chain (25)【树+搜索】——PAT (Advanced Level) Practise
题目信息 1079. Total Sales of Supply Chain (25) 时间限制250 ms 内存限制65536 kB 代码长度限制16000 B A supply chain is ...
- PAT (Advanced Level) Practise - 1099. Build A Binary Search Tree (30)
http://www.patest.cn/contests/pat-a-practise/1099 A Binary Search Tree (BST) is recursively defined ...
- 1076. Forwards on Weibo (30)【树+搜索】——PAT (Advanced Level) Practise
题目信息 1076. Forwards on Weibo (30) 时间限制3000 ms 内存限制65536 kB 代码长度限制16000 B Weibo is known as the Chine ...
- 1064. Complete Binary Search Tree (30)【二叉树】——PAT (Advanced Level) Practise
题目信息 1064. Complete Binary Search Tree (30) 时间限制100 ms 内存限制65536 kB 代码长度限制16000 B A Binary Search Tr ...
- PAT (Advanced Level) Practise:1002. A+B for Polynomials
[题目链接] This time, you are supposed to find A+B where A and B are two polynomials. Input Each input f ...
随机推荐
- AT2672 Coins
传送门 按理说想到转化问题之后就不难了吧,可是我还是不会写 一个很容易想到的转化就是差分,将银币数和铜币数都减去金币数,这样就转化为\(x+y+z\)个钱币选\(y\)个银币和\(z\)个铜币的最大数 ...
- BZOJ 2973 石头游戏 矩乘加速递推
FFFFFFF,看了一上午才看懂,又调了一中午.....我终于明白为何自己如此菜了qwq 这个题加速的思路是:因为每个序列的长度小于6,他们的lcm是60,所以六十次以后就会回到原来的序列. 加速的就 ...
- mysql /etc/my.cnf
[client] port=3306 socket = /tmp/mysql.sock default-character-set=utf8 [mysqld] # 1 general config p ...
- 查询时根据权限更改sql
import java.lang.reflect.Method; import org.apache.log4j.Logger; import org.springframework.aop.Meth ...
- jsonp——使用公共接口获取数据
demo: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8 ...
- javascript模块化编程规范
一.javascript模块化编程规范: 二.关于commenjs规范和AMD规范: 根本不同:前者用于服务器端同步加载模块:后者是客户端异步加载模块. 同点:两者都有一个全局函数require(), ...
- JavaEE 7 新特性之WebSocket
开发环境: JDK:1.7及以上 JavaEE:1.7,因为只有javaee7才有websocke的api,也可以使用1.6单都导入websocket-api.jar试试(本人不清楚) 注意:没有使用 ...
- 原型设计工具 Axure RP 7.0下载地址及安装说明
Axure RP是产品经理必备的原型制作工具,因为很多同学是新手,在这里整理一下axure7.0的下载.安装和汉化流程,希望能够帮到大家. Axure RP是美国Axure Software Solu ...
- C#语言使用习惯
1.使用属性而不是可访问的数据成员 2.用运行时常量(readonly)而不是编译期常量(const) 编译期常量与运行时常量行为的不同之处在于对他们的访问方式不同,编译期常量的值是在目标代码中进行替 ...
- PC端下载图片
PC端将图片下载到本地saveFile(imgdata,filename){ var save_link=document.createElementNS('http://www.w3.org/199 ...