HDU Problem - 6124 Euler theorem
题目:Problem - 6124
http://acm.hdu.edu.cn/showproblem.php?pid=6124
Euler theorem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 601 Accepted Submission(s): 481
Problem Description
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember the value of a, please tell him the number of different possible results.
Input
The first line contains a positive integer T(1≤T≤5), denoting the number of test cases.
For each test case:
A single line contains a positive integer a(1≤a≤109).
Output
For each test case:
A single line contains a nonnegative integer, denoting the answer.
Sample Input
2
1
3
Sample Output
2
3
Source
2017 Multi-University Training Contest - Team 7
水题,直接上代码
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <stack>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <iterator>
#include <set>
#include <map>
#include <utility>
#include <iomanip>
#include <ctime>
#include <sstream>
#include <bitset>
#include <deque>
#include <limits>
#include <numeric>
#include <functional> #define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define mod 1000000007
#define sort(a,n,int) sort(a,a+n,less<int>())
#define fread() freopen("in.in","r",stdin)
#define fwrite() freopen("out.out","w",stdout)
using namespace std; typedef long long ll;
typedef char ch;
typedef double db; const int maxn=1e5+10; int main()
{
int t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
cout<<(n+1)/2+1<<endl;
}
return 0;
}
HDU Problem - 6124 Euler theorem的更多相关文章
- HDU 6124 Euler theorem
Euler theorem 思路:找规律 a 余数 个数 1 0 1 2 2 0 2 ...
- 数学--数论--HDU - 6124 Euler theorem (打表找规律)
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the ...
- HDU 6322.Problem D. Euler Function -欧拉函数水题(假的数论题 ̄▽ ̄) (2018 Multi-University Training Contest 3 1004)
6322.Problem D. Euler Function 题意就是找欧拉函数为合数的第n个数是什么. 欧拉函数从1到50打个表,发现规律,然后勇敢的水一下就过了. 官方题解: 代码: //1004 ...
- hdu 2824 The Euler function(欧拉函数)
题目链接:hdu 2824 The Euler function 题意: 让你求一段区间的欧拉函数值. 题解: 直接上板子. 推导过程: 定义:对于正整数n,φ(n)是小于或等于n的正整数中,与n互质 ...
- HDU 6124 17多校7 Euler theorem(简单思维题)
Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb. Bu ...
- hdu 1788 Chinese remainder theorem again(最小公倍数)
Problem Description 我知道部分同学最近在看中国剩余定理,就这个定理本身,还是比较简单的: 假设m1,m2,-,mk两两互素,则下面同余方程组: x≡a1(mod m1) x≡a2( ...
- hdu 3689 Infinite monkey theorem
Infinite monkey theorem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- hdu 2824 The Euler function
The Euler function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU 3689 Infinite monkey theorem [KMP DP]
Infinite monkey theorem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- (2018 Multi-University Training Contest 3)Problem D. Euler Function
//题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 //题目大意:给定 k,求第 k 小的数 n,满足 φ(n) 是合数.显然 φ(1) = 1 ...
随机推荐
- windows系统应急
Windows系统的应急响应主要关注在发生安全事件或攻击后,如何迅速采取措施恢复系统的正常运行并确保数据的安全性.应急响应的目标是减少系统受到攻击的损害.恢复操作以及防止类似事件的再次发生. 应急响应 ...
- 部分请求报 CROS ERROR
当我在写系统时,发现/post/list请求报错跨域问题.但是/login,logout请求能通过.报错为下: 于是开始找文档,最开始以为是后端跨域配置导致的(但是仔细一想,发现/login又能够通过 ...
- Python之multiprocessing.Pool(创建多个子进程)
当需要创建的子进程数量不多的时候可以直接利用multiprocessing中的Process动态生成多个进程.但是,如果是成百上千个任务,手动创建显然不合适,此时就可以用multiprocessing ...
- AI大模型应用开发入门-LangChain实现文档总结
一.整体思路 长网页文本往往超过 LLM 单次处理的 token 限制,我们需要设计一个 map-reduce 流水线来拆分.局部总结.归并: 加载网页内容 拆分成可控大小的 chunk 对每个 ch ...
- C# 设置dll 别名
extern alias VideoFFMPEGX64;using VideoFFMPEGX64::Accord.Video.FFMPEG;
- mermaid与marked结合使用
前提 两者都很强大,但是两者结合,存在问题,目前网上无解. 以下两种版都需要在index.html 即入口页面添加一个元素 <body> <div id="root&quo ...
- 前端开发系列107-工程化篇之Bower的安装和使用
本文主要介绍前端开发中常用的包管理工具Bower,具体包括Bower的基本情况.安装.使用和常见命令等内容,最后还介绍了依赖树管理的常见方式以及Bower采用的策略并进行了比较. 1.0 关于Bowe ...
- 前端开发系列062-网络篇之前端开发Ajax简单介绍
一.Ajax技术简单介绍 Ajax是一门异步的用于发送网络请求的技术. 全称为:Async javascript and XML. 简单说明:Ajax 这个概念是由 Jesse James Garre ...
- c++ stl iterator erase
简介 就是C++ 标准库程序删除元素. 其实很简单,只是做个记录 it = monkeys.erase(it); //删除元素后,迭代器失效, //要重新让迭代器指向被删元素的后面
- 模拟退火 python 实现
简介 一直以为是一个高深的算法,好像据说在量子计算机中可以应用.发现原理并不难 参考链接 https://blog.csdn.net/google19890102/article/details/45 ...