input

长度不大于3*10e5的数字串

output

不含前导0的能整除64的字串的个数(0算一个,064不算)

一般数组中找能整除一个数的字串都是用取余来做的

用一个a[64]来存下从1-i位累加到第i位的余数为0-63的个数,每次都加上余数为0的个数,第一位为0的只统计一次,不加入a数组中

 #include <iostream>
#include <cstdio>
#include <cstring> using namespace std; char s[];
int a[][],b[],sum,d; int main()
{
while(scanf("%s",s)==)
{
memset(a,,sizeof(a));
sum=;
d=;
for(int i=;s[i];i++)
{
memset(a[d^],,sizeof(a[]));
if(s[i]!='') a[d][]++;
else sum++;
for(int j=;j<;j++)
{
int t=j*+s[i]-'';
a[d^][t%]+=a[d][j];
}
sum+=a[d^][];
d^=;
}
printf("%d\n",sum);
}
return ;
}

HUST - 1599 Multiple的更多相关文章

  1. HUST 1599 - Multiple(动态规划)

    1599 - Multiple 时间限制:2秒 内存限制:64兆 461 次提交 111 次通过 题目描述 Rocket323 loves math very much. One day, Rocke ...

  2. POJ 1426 Find The Multiple --- BFS || DFS

    POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至 ...

  3. hust 1385 islands 并查集+搜索

    islands Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/problem/show/1385 Descri ...

  4. Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...

    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...

  5. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  6. [LeetCode] Read N Characters Given Read4 II - Call multiple times 用Read4来读取N个字符之二 - 多次调用

    The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actu ...

  7. SharePoint "System.Data.SqlClient.SqlException (0x80131904): Parameter '@someColumn' was supplied multiple times.“

    最近在处理SharePoint Office365的相关开发的时候发现了这样一个奇怪的现象: 无法通过API更新Editor field,只要已更新就会throw Exception,由于是Offic ...

  8. 2012Chhengdu K - Yet Another Multiple Problem

    K - Yet Another Multiple Problem Time Limit:20000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  9. JAVA实现AES 解密报错Input length must be multiple of 16 when decrypting with padded cipher

    加密代码 /**解密 * @param content 待解密内容 * @param password 解密密钥 * @return */ public static byte[] decrypt(b ...

随机推荐

  1. VBO

    #include <GL/glew.h> #include <GL/glut.h> #include <iostream> #pragma comment(lib, ...

  2. HDU 2614 Beat(DFS)

    题目链接 Problem Description Zty is a man that always full of enthusiasm. He wants to solve every kind o ...

  3. 关于开启url的pathinfo模式

    1.apache要开启pathinfo模式,需要在 <Directory /> Options +Indexes +FollowSymLinks +ExecCGI AllowOverrid ...

  4. java反射机制(2)

    首先,我们在开始前提出一个问题: 1.在运行时,对于一个java类,能否知道属性和方法:能否去调用它的任意方法? 答案是肯定的. 本节所有目录如下: 什么是JAVA的反射机制 JDK中提供的Refle ...

  5. 第2章 熟悉Eclipse开发工具----加减乘除,和差积商的英文写法

    加减乘除表示运算:plus  minus multiply divide和差积商表示运算结果:sum difference product quotient

  6. javacript没有多维数组只能模拟?

    为什么说javacript没有多维数组只能模拟?但是我看到是可以实现多维数组的啊!这是为什么呢?下面我们来实验下. <!DOCTYPE html> <html lang=" ...

  7. 【开发笔记】java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor

    在进行"spring的声明式事务管理配置"的时候,抛出该异常. 错误原因: 缺少aopalliance.jar包. 事务管理配置如下: <!-- #######5.sprin ...

  8. 在64位Win7操作系统中安装Microsoft Access Engine的解决方案

    在64位Win7操作系统中安装Microsoft Access Engine的解决方案 现在的Win7系统中安装的一般都是32位的Office,因为微软推荐使用32位的Office,兼容性更强,稳定性 ...

  9. linux安装文件命令

    tar -zxvf apache-tomcat.tar.gz -C /home/poka 注:安装tar.gz的安装包 设置系统自动启动tomcat 切换到root用户,执行命令 #chkconfig ...

  10. SVG中image tag的高亮

    今天下午和晚上全部在实验室调试scs可视化,下午主要时间在调试字符云图的东西,不过感觉没有提升,还是不好看,囧~~ 把力道图中的线条给调整了,调细之后,好看了不少. 因为需要多个区域交互,也就是需要高 ...