Codeforces 451 D. Count Good Substrings
来源:互联网 发布:剑三抓马坐标数据下载 编辑:程序博客网 时间:2024/05/01 09:38
import java.util.*;public class Main{public static void main(String[] args){Scanner in=new Scanner(System.in);String str=in.nextLine();long a0=0,a1=0,b0=0,b1=0,d=0;for(int i=0;i<str.length();i++){if(str.charAt(i)=='a'){if(i%2==0){a0++;d+=a0;}else{a1++;d+=a1;}}else if(str.charAt(i)=='b'){if(i%2==0){b0++;d+=b0;}else{b1++;d+=b1;}}}System.out.println((a0*a1+b0*b1)+" "+d);}}
0 0
- Codeforces 451D Count Good Substrings
- codeforces 451D Count Good Substrings 枚举
- Codeforces 451D Count Good Substrings
- 【杂题】 codeforces 451D Count Good Substrings
- Codeforces 451 D. Count Good Substrings
- CodeForces 451D Count Good Substrings
- codeforces 451 D.Count Good Substrings (思维)
- 451 D. Count Good Substrings
- Codeforces 451D Count Good Substrings(组合数学)
- Codeforces 451D Count Good Substrings (组合数)
- Codeforces 451D - Count Good Substrings(组合数学)
- CodeForces 451 D.Count Good Substrings(水~)
- Codeforces #258 (Div. 2) D. Count Good Substrings
- Codeforces Round #258 (Div. 2) D. Count Good Substrings
- Codeforces Round #258 (Div. 2)-D. Count Good Substrings
- codeforces 166 Count Good Substrings 字符串hash
- Codeforces Round #258 (Div. 2) D. Count Good Substrings —— 组合数学
- Codeforces 271D Good Substrings 暴力+Trie
- 不自动添加换行符的puts()
- 进程间通信______信号集
- WebLogic之domain域安装
- poj-1751 Highways 最小生成树
- UVa 11584 - Partitioning by Palindromes(简单DP)
- Codeforces 451 D. Count Good Substrings
- python读取文件
- windows线程池的使用
- 在Eclipse中安装StatET插件
- WPF:DataGrid分页实现
- 轻量级Java EE 企业应用实战-JSP笔记(二)-JSP对象介绍
- Hdu1757 - A Simple Math Problem - 矩阵快速幂
- Pig Latin练习-python
- Linux ssh(以及其他访问主机方式)登录变慢解决方法