输入样例
1 1
2 1
3 2
输出样例
2
2
2
f(x)打表找规律的 fx=x+1,fn(x)=x+n+1;然后用欧拉公式
 #include <iostream>
#include <cstdio>
using namespace std; __int64 euler(__int64 n)
{
__int64 i;
__int64 res = n, a = n;
for(i = ;i*i <= a; ++i)
{
if(a%i == )
{
res -= res / i;
while(a % i == )
{
a /= i;
}
}
}
if(a > ) res -= res/a;//存在大于sqrt(a)的质因子
return res;
} int main()
{
__int64 n, x;
while (~scanf("%I64d%I64d", &n, &x))
{
__int64 ans = n + x + ;
printf("%I64d\n", euler(ans));
}
return ;
}

欧拉(BC)的更多相关文章

  1. HDU5780 gcd 欧拉函数

    http://acm.hdu.edu.cn/showproblem.php?pid=5780 BC #85 1005 思路: 首先原式化简:x​^gcd(a,b)​​−1 也就是求n内,(公约数是i的 ...

  2. POJ 2208 Pyramids 欧拉四面体

    给出边长,直接就可以求出体积咯 关于欧拉四面体公式的推导及证明过程 2010-08-16 14:18 1,建议x,y,z直角坐标系.设A.B.C少拿点的坐标分别为(a1,b1,c1),(a2,b2,c ...

  3. HDU 1411--校庆神秘建筑(欧拉四面体体积计算)

    校庆神秘建筑 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  4. 数论的欧拉定理证明 &amp; 欧拉函数公式(转载)

    欧拉函数 :欧拉函数是数论中很重要的一个函数,欧拉函数是指:对于一个正整数 n ,小于 n 且和 n 互质的正整数(包括 1)的个数,记作 φ(n) . 完全余数集合:定义小于 n 且和 n 互质的数 ...

  5. Exponial~(欧拉函数)~(发呆题)

    Description Everybody loves big numbers (if you do not, you might want to stop reading at this point ...

  6. 欧拉定理、欧拉函数、a/b%c

    怕忘了…… 欧拉函数 定义.证明.打表方法 欧拉定理 定义.证明 https://blog.csdn.net/zzkksunboy/article/details/73061013 剩余系.完系.简系 ...

  7. hdu2588 GCD (欧拉函数)

    GCD 题意:输入N,M(2<=N<=1000000000, 1<=M<=N), 设1<=X<=N,求使gcd(X,N)>=M的X的个数.  (文末有题) 知 ...

  8. BZOJ 2705: [SDOI2012]Longge的问题 [欧拉函数]

    2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 2553  Solved: 1565[Submit][ ...

  9. BZOJ 2818: Gcd [欧拉函数 质数 线性筛]【学习笔记】

    2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 4436  Solved: 1957[Submit][Status][Discuss ...

  10. Euler-Maruyama discretization("欧拉-丸山"数值解法)

    欧拉法的来源 在数学和计算机科学中,欧拉方法(Euler method)命名自它的发明者莱昂哈德·欧拉,是一种一阶数值方法,用以对给定初值的常微分方程(即初值问题)求解.它是一种解决常微分方程数值积分 ...

随机推荐

  1. Java学习笔记--Java图形用户界面

    AWT:抽象窗口组件工具包 Abstract Windows Toolkit(AWT)是最原始的 Java GUI 工具包.AWT 的主要优点是,它在 Java 技术的每个版本上都成为了一种标准配置, ...

  2. 数据库语句union的总结

    select * from ( (select * from user limit 0,3) union (select * from user limit 10,30) ) tmp where ui ...

  3. 关于box-sizing

    http://www.zhangxinxu.com/css3/css3-box-sizing.php box-sizing:border-box; -o-box-sizing:border-box; ...

  4. JAVA字符串转日期或日期转字符串

    文章中,用的API是SimpleDateFormat,它是属于java.text.SimpleDateFormat,所以请记得import进 来! 用法: SimpleDateFormat sdf = ...

  5. 【转】android 兼容性测试 CTS 测试过程(实践测试验证通过)

    原文网址:http://blog.csdn.net/jianguo_liao19840726/article/details/7222814 写这个博客的时候是为了记忆,建议大家还是看官方的说明,官方 ...

  6. C++函数后面加const修饰

    声明一个成员函数的时候用const关键字是用来说明这个函数是 "只读(read-only)"函数,也就是说明这个函数不会修改任何数据成员(object). 为了声明一个const成 ...

  7. c++智能指针《一》 auto_ptr

    转载http://www.cnblogs.com/gnagwang/archive/2010/11/19/1881811.html C++的auto_ptr auto_ptr所做的事情,就是动态分配对 ...

  8. 04747_Java语言程序设计(一)_第9章_输入和输出流

    例9.1一个文件复制应用程序,将某个文件的内容全部复制到另一个文件. import java.io.*; public class Example9_1 { public static void ma ...

  9. Android设备内存和SD卡操作工具类

    package cc.c; import java.io.File; import java.util.List; import android.os.StatFs; import java.io.F ...

  10. [RxJS] Reactive Programming - Why choose RxJS?

    RxJS is super when dealing with the dynamic value. Let's see an example which not using RxJS: var a ...