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 ...
随机推荐
- sql中给逗号分隔的查询结果替换单引号
技术交流群:233513714 第一种方法: SELECT * FROM pay_inf_config a WHERE a.id IN ( SELECT REPLACE ( concat('''', ...
- 1.bootstrap的HTML文件编写规范
1.head标签里面的内容 <!DOCTYPE html> <html lang="zh-cn"> <head> <!-- 页面编码 -- ...
- 查询数据库里当前用户下的所有表的总共数据sql
select t.table_name,t.num_rows from user_tables t select sum(num_rows) from user_tables t
- laravel5.5表单验证
1. 在第一次验证失败后停止 有时,你希望在某个属性第一次验证失败后停止运行验证规则.为了达到这个目的,附加 bail 规则到该属性: $this->validate($request, [ ' ...
- 每天一个Linux命令(5):rm命令
rm命令可以删除一个目录中的一个或多个文件或目录,也可以将某个目录及其下属的所有文件及其子目录均删除掉.对于链接文件,只是删除整个链接文件,而原有文件保持不变. 语法 rm (选项)(参数) 选项 - ...
- ffifdyop
题目地址:http://www.shiyanbar.com/ctf/2036 后台登陆 上来看到这个界面,果断先看一波源代码. 看到是拼接字符串进行sql查询,就想到了注入了. 但是很不幸的是md5( ...
- linux->centos7设置tomcat开机自启
找到/etc/rc.d/文件下的rc.local,添加如下内容 export JAVA_HOME=/usr/local/jdk1.8.0_144export JRE_HOME=$JAVA_HOME/j ...
- mac安装虚拟机VirtualBox,并在虚拟机上安装centos
1. 首先从网页上https://www.virtualbox.org/wiki/Downloads下载VirtualBox-6.0.0-127566-OSXdmg文件.我一般把下载的文件放到/opt ...
- Python学习-day18 Web框架
众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 ...
- wxPython 安装 及参考文档
三种操作平台上的安装方法 1.windows 和 mac pip install -U wxPython 2.linux pip install -U -f https://extras.wxpyth ...