AC日记——Little Elephant and Numbers codeforces 221b
221B - Little Elephant and Numbers
思路:
水题;
代码:
- #include <cmath>
- #include <cstdio>
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int n,ans=;
- bool if_[];
- int main()
- {
- scanf("%d",&n);
- int pos=n;
- while(pos>) if_[pos%]=true,pos/=;
- for(int i=;i<=sqrt(n);i++)
- {
- if(n%i==)
- {
- pos=i;
- while(pos>)
- {
- if(if_[pos%])
- {
- ans++;
- break;
- }
- pos/=;
- }
- pos=n/i;
- while(pos>)
- {
- if(if_[pos%])
- {
- ans++;
- break;
- }
- pos/=;
- }
- }
- }
- if(sqrt(n)*sqrt(n)==n)
- {
- pos=sqrt(n);
- while(pos>)
- {
- if(if_[pos%])
- {
- ans--;
- break;
- }
- pos/=;
- }
- }
- cout<<ans;
- return ;
- }
AC日记——Little Elephant and Numbers codeforces 221b的更多相关文章
- AC日记——Little Elephant and Shifts codeforces 221e
E - Little Elephant and Shifts 思路: 一次函数线段树(疯狂debug): b不断循环左移,判断每次最小的|i-j|,a[i]=b[j]: 仔细观察发现,每个bi移动时, ...
- AC日记——Little Elephant and Array codeforces 221d
221D - Little Elephant and Array 思路: 莫队: 代码: #include <cmath> #include <cstdio> #include ...
- AC日记——Little Elephant and Function codeforces 221a
A - Little Elephant and Function 思路: 水题: 代码: #include <cstdio> #include <iostream> using ...
- AC日记——Little Elephant and Problem codeforces 221c
221C 思路: 水题: 代码: #include <cstdio> #include <cstring> #include <iostream> #include ...
- AC日记——Sagheer and Nubian Market codeforces 812c
C - Sagheer and Nubian Market 思路: 二分: 代码: #include <bits/stdc++.h> using namespace std; #defin ...
- AC日记——Red and Blue Balls codeforces 399b
399B - Red and Blue Balls 思路: 惊讶的发现,所有的蓝球的消除都是独立的: 对于在栈中深度为i的蓝球消除需要2^i次操作: 代码: #include <cstdio&g ...
- AC日记——Andryusha and Colored Balloons codeforces 780c
C - Andryusha and Colored Balloons 思路: 水题: 代码: #include <cstdio> #include <cstring> #inc ...
- AC日记——The Child and Sequence codeforces 250D
D - The Child and Sequence 思路: 因为有区间取模操作所以没法用标记下传: 我们发现,当一个数小于要取模的值时就可以放弃: 凭借这个来减少更新线段树的次数: 来,上代码: # ...
- Codeforces 221 B. Little Elephant and Numbers
B. Little Elephant and Numbers time limit per test 2 seconds memory limit per test 256 megabytes inp ...
随机推荐
- Kafka写入流程和副本策略
Kafka写入流程: 1.producer 先从 zookeeper 的 "/brokers/.../state" 节点找到该 partition 的 leader 2. prod ...
- 剑指Offer - 九度1504 - 把数组排成最小的数
剑指Offer - 九度1504 - 把数组排成最小的数2014-02-06 00:19 题目描述: 输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个.例如输 ...
- c语言字符串内存分配小记
一.疑问 有这样一道题: #include "stdio.h" int main() { ]; ]; scanf("%s", word1); scanf(&qu ...
- 项目中DataTables分页插件的使用
在项目开发的过程中,一般都会对表格进行分页处理,大多是情况下会在项目中配置好后台分页插件,提高效率,减轻浏览器的压力.但是有时会遇到有些数据不能直接通过分页插件操作数据库进行分页数据查询,那就需要用到 ...
- 安装启动Apache2.4后报Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration错误
LoadModule access_compat_module modules/mod_access_compat.so 取消这一行模块的注释,再重启服务即可. 搜索 mod_access_compa ...
- lshw
https://linux.die.net/man/1/lshw lshw(Hardware Lister)是另外一个可以查看硬件信息的工具,不仅如此,它还可以用来做一些硬件的benchmark. 这 ...
- UVa 1326 - Jurassic Remains(枚举子集+中途相遇法)
训练指南p.59 #include <cstdio> #include <cstring> #include <cstdlib> #include <map& ...
- fisheye在centos上的安装
目录 描述 部署过程 安装及配置 破解 添加存贮库 在jira上配置 描述 Fisheye 一个源代码库深度查看软件,它可以挖掘源代码库中的有用信息,呈现在Web浏览器界面上. Crucible是一个 ...
- 【bzoj1070】[SCOI2007]修车 最小费用流
原文地址:http://www.cnblogs.com/GXZlegend/p/6798411.html 题目描述 同一时刻有N位车主带着他们的爱车来到了汽车维修中心.维修中心共有M位技术人员,不同的 ...
- Spark on Yarn——spark1.5.1集群配置
写在前面: spark只是一种计算框架,如果要搭建集群要依托与一定的组织模式. 目前来说,Spark集群的组织形式有三种: 1. Standalone:使用akka作为网络IO组件,mast ...