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 ...
随机推荐
- vue理解$nextTick
首先要明确: Vue 实现响应式并不是数据发生变化之后 DOM 立即变化,而是按一定的策略进行 DOM 的更新. $nextTick 是在下次 DOM 更新循环结束之后执行延迟回调,在修改数据之后使用 ...
- 为 DirectAccess 设计 DNS 基础结构
TechNet 库Windows ServerWindows Server 2008 R2 und Windows Server 2008浏览 Windows Server 技术NetworkingD ...
- runtime怎么添加属性、方法等
ivar表示成员变量 class_addIvar class_addMethod class_addProperty class_addProtocol class_replaceProperty
- Leetcode with Python -> Sort
349. Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Ex ...
- NodeJs02 美女爬虫
note: demo代码要编号 导出模块 一个js文件就是一个模块,模块内部的所有变量,对象,方法对外界都不可见.如果想暴漏出去让别人用,就需要导出模块.语法如下: module.exports = ...
- 爬虫:Scrapy16 - Spider Contracts
Scrapy 通过合同(contract)的方式来提供了测试 spider 的集成方法. 可以硬编码(hardcode)一个样例(sample)url,设置多个条件来测试回调函数处理 response ...
- HDU 4116 Fruit Ninja ( 计算几何 + 扫描线 )
给你最多1000个圆,问画一条直线最多能与几个圆相交,相切也算. 显然临界条件是这条线是某两圆的公切线,最容易想到的就是每两两圆求出所有公切线,暴力判断一下. 可惜圆有1000个,时间复杂度太高. 网 ...
- ComboBox列表自定义类保存数据
之前没弄明白ComboBox还可以这样用. 先建一个ComboBox子项类,然后可以获取该项类做一些判断,关键是要重写ToString()方法. public class ComboItem { pu ...
- IIS7 无法显示 htm js 图片 css的问题
中文:开始->控件面板->程序->打开或关闭windows功能->Internet信息服务->万维网服务->常见http功能->静态内容(选中) englis ...
- MapReduce架构
主从结构 主节点:JobTracker(一个) 从节点:TaskTrackers(多个) JobTracker: 接收客户提交的计算任务 把计算任务分配给TaskTrackers执行 监控TaskTr ...