POJ 2407Relatives
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 15566 | Accepted: 7900 |
Description
Input
Output
Sample Input
7
12
0
Sample Output
6
4
Source
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#define LL long long
using namespace std;
int main()
{
LL N;
while(cin>>N&&N!=)
{
int limit=sqrt(N),ans=N;
for(int i = ; i <= limit ; ++i)
{
if(N%i==) ans=ans/i*(i-);
while(N%i==) N=N/i;
}
if(N>) ans=ans/N*(N-);
printf("%d\n",ans);
}
return ;
}
POJ 2407Relatives的更多相关文章
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- POJ 2752 Seek the Name, Seek the Fame [kmp]
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17898 Ac ...
- poj 2352 Stars 数星星 详解
题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- 如何将一个文本内容通过PHP 以表格的方式输入到页面上
如何将一个文本内容通过PHP 以表格的方式输入到页面上 <?php //读取文本内容 $contents = file_get_contents("names.txt"); ...
- java中根据key获取resource下properties资源文件中对应的参数
properties资源文件是放在resource目录下的: 新建工具类: package com.demo.utils; import java.io.InputStream; import jav ...
- 关于DB Link
概述 DB Link是一个定义了本地数据库到远程数据库路径的对象,是schema object,它是单向连接 通过DB Link可查询remote数据库的对象及运行其程序 在分布式环境里,DB Lin ...
- ES6常用特性总览
以前看过一遍es6,今天面试时被问到了一个很简单的es6特性,竟然没回答上来,特来重温一下es6,做个总结性笔记. 一.什么是es6 es6是新版本JavaScript语言的标准,在2015年6月发布 ...
- odoo开发笔记--取消正在升级中模块
场景描述: 开发过程中,有时候会遇到,模块安装的时候,一直卡着,走不过去:或者安装报错,导致进入了系统! 这个时候,怎么处理呢? 先简单说下,odoo中模块的升级有4个状态,模块相关的安装情况记录在表 ...
- mysql 开发进阶篇系列 14 锁问题(避免死锁,死锁查看分析)
一. 概述 通常来说,死锁都是应用设计问题,通过调整业务流程,数据库对象设计,事务大小,以及访问数据库的sql语句,绝大部分死锁都可以避免,下面介绍几种避免死锁的常用 方法. 1. 在应用中,如果不同 ...
- 我可能不懂Array.prototype.sort
今天 fix 我们后台系统的一些 bug.系统是基于 beego 和模板开发的,各种前后端代码揉作一团,没有格式,没有 eslint,全局变量满天飞,连 js 代码都有后端的插值,读起来非常 酸爽. ...
- solr(六): 集群
前言 随着用户的增多,空间和并发量越来越多,会导致一台solr服务器干不过了.这时候,就需要将solr集群以下. 集群架构 由多台服务器共同完成索引和搜索任务 实现的思路是将索引数据进行shard(分 ...
- systemctl enable docker.service
[root@dingyingsi ~]# systemctl start docker.service [root@dingyingsi ~]# systemctl enable docker.ser ...
- python 闯关之路四(上)(并发编程与数据库理论)
并发编程重点: 并发编程:线程.进程.队列.IO多路模型 操作系统工作原理介绍.线程.进程演化史.特点.区别.互斥锁.信号. 事件.join.GIL.进程间通信.管道.队列. 生产者消息者模型.异步模 ...