#include "stdio.h"int main(){ int p = 0, a = 0, t = 0; char c; while(scanf("%c", &c) && ('\n' != c)) { if('P' == c) ++p; else if('A' == c) a += p; else if('T' == c) t = (t + a) % 1000000007; } printf("%d\n", t); return 0;}
本文共 286 字,大约阅读时间需要 1 分钟。
#include "stdio.h"int main(){ int p = 0, a = 0, t = 0; char c; while(scanf("%c", &c) && ('\n' != c)) { if('P' == c) ++p; else if('A' == c) a += p; else if('T' == c) t = (t + a) % 1000000007; } printf("%d\n", t); return 0;}
转载于:https://www.cnblogs.com/gavanwanggw/p/7349821.html