Bi-shoe and Phi-shoe LightOJ - 1370】的更多相关文章

/* LightOJ 1370 Bi-shoe and Phi-shoe http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1370 数论 欧拉函数 坑点是答案会爆int!!!! */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector…
A - Bi-shoe and Phi-shoe Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1370 Appoint description:  System Crawler  (2016-07-08) Description Bamboo Pole-vault is a massively popular sport in X…
http://lightoj.com/volume_showproblem.php?problem=1370 Bi-shoe and Phi-shoe Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1370 Description Bamboo Pole-vault is a massively popular sport in X…
1370 - Bi-shoe and Phi-shoe   PDF (English) Statistics   Time Limit: 2 second(s) Memory Limit: 32 MB Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for hi…
题目链接: http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1370 题意: 给定值,求满足欧拉值大于等于这个数的最小的数. 分析: 两个质数之间的合数的欧拉值小于较小的质数,所以满足比给定的值大的欧拉值肯定是大于这个数的第一个质数. 二分查找一下就好了. 代码: #include <iostream> #include<cstdio> #include<algorithm> #i…
分析:对于每个数,找到欧拉函数值大于它的,且标号最小的,预处理欧拉函数,然后按值建线段树就可以了 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <cmath> #include <map> using namespace std; typedef long long LL; ; const int INF…
Bi-shoe and Phi-shoe Time Limit: 2000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu Submit Status Description Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs…
题意:给N个数,求对每个数ai都满足最小的phi[x]>=ai的x之和. 分析:先预处理出每个数的欧拉函数值phi[x].对于每个数ai对应的最小x值,既可以二分逼近求出,也可以预处理打表求. #include<bits/stdc++.h> using namespace std; typedef long long LL; ; int phi[maxn]; int res[maxn]; bool isprime[maxn]; void Euler(){ //欧拉函数筛 ;i<ma…
给出x,求最小的y使y的欧拉函数大于等于x *解法:i).求出1e6之内的数的欧拉函数,遍历找             ii).求比x大的第一个质数——因为每个质数n的欧拉函数都是n-1 wa一次是因为SZ写小了…… #include <iostream> #include <cstdio> using namespace std; #define SZ 1000005 long long phi[SZ], a[SZ]; void getphi(int n) { ; i <=…
Bi-shoe and Phi-shoe Descriptions: 给出一些数字,对于每个数字找到一个欧拉函数值大于等于这个数的数,求找到的所有数的最小和. Input 输入以整数T(≤100)开始,表示测试用例的数量. 每个案例都以一行包含整数n(1≤n≤10000)开始,表示有n个数.下一行包含n个空格分隔的整数,表示数字.每个数字都在[1,10^6]范围内. Output 求找到的所有数的最小和 Sample Input 3 5 1 2 3 4 5 6 10 11 12 13 14 15…