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 ...
随机推荐
- Java虚拟机之搜索class文件
Java命令 Java虚拟机的工作是运行Java应用程序.和其他类型的应用程序一样,Java应用程序也需要一个入口点,这个入口点就是我们熟知的main()方法.如果一个类包含main()方法,这个类就 ...
- echarts 地图的背景色和各省颜色配置以及地图饼图联动
myChart.on(ecConfig.EVENT.MAP_SELECTED, function (param) { var selected = param.selected; var str = ...
- mutable c++
The keyword mutable is used to allow a particular data member of const object to be modified. This i ...
- USACO Section1.3 Wormholes 解题报告
wormhole解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------- ...
- python实现单链表的反转
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/usr/bin/env python #coding = utf-8 ...
- python判断mongodb--find(),find_one()返回是否为空
conn = MongoClient('127.0.0.1', 27017)db = conn.diffcollection = db['test1']result = collection.find ...
- day04_08-while查询所有行
<?php $link = @mysql_connect('localhost','root',''); mysql_query('use test',$link); mysql_query(' ...
- ssh.sh_for_ubuntu1404
#!/bin/bash sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config s ...
- 【志银】Dev-Cpp配置OpenGL图形库(成功版本:Dev-Cpp 5.7.1 MinGW 4.8.1)
★配置前须知:Dev-Cpp自带OpenGL的使用和OpenGL简介 (附Dev-Cpp下载地址:http://sourceforge.net/projects/orwelldevcpp/?sourc ...
- django orm 之makemigrations和migrate命令
makemigrations:将模型的更改生成迁移脚本文件.模型所在的app,必须放在settings.py中的INSTALLED_APPS列表中.这个命令有以下几个常用选项: 1.app_label ...