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 ...
随机推荐
- springboot配多数据源
多数据源配置 https://blog.csdn.net/neosmith/article/details/61202084 https://www.cnblogs.com/zhangboyu/p/7 ...
- ASP NET Core ---FluentValidation
官方文档:https://fluentvalidation.net/ 一.安装: 二.应用: 1.建立PostValidator: public class PostValidator:Abstrac ...
- 孤荷凌寒自学python第三十三天python的文件操作初识
孤荷凌寒自学python第三十三天python的文件操作初识 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 今天开始自学python的普通 文件操作部分的内容. 一.python的文件打开 ...
- 孤荷凌寒自学python第二十八天python的datetime.date模块
孤荷凌寒自学python第二十八天python的datetime.date模块 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 一.toordinal() 此方法将访问从公元1年1月1日至当 ...
- 转:sift算法详解
转自:http://blog.csdn.net/pi9nc/article/details/23302075 对于初学者,从David G.Lowe的论文到实现,有许多鸿沟,本文帮你跨越. 1.SIF ...
- python 常见的错误类型 和 继承关系
BaseException +-- SystemExit #系统结束 +-- KeyboardInterrupt #键盘中断 ctrl+D +-- GeneratorExit #主动结束 +-- Ex ...
- SpringBoot Rabbitmq发送消息
官方文档:https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/htmlsingle/#boot-features-amqp ...
- Spring 学习笔记(六)—— AOP的简单理解
系统中的业务可以分为核心关注点和横切关注点. 核心关注点时业务处理的主要流程,而横切关注点是与核心业务无关但更为通用的业务. 各个横切关注点离散地穿插于核心业务之中,导致系统地每一个模块都与这些业务具 ...
- docker 生成新的镜像
下载了ubuntu的初始化镜像,但是没有网络安装包,安装了字后,如果生成新的镜像 sudo docker commit -m "add ifconfig/ping package" ...
- vue cli & npm err & shit cnpm
vue cli & npm err & shit cnpm npm err & shit cnpm https://github.com/vuejs/vue-cli/issue ...