HDU 6124-Euler theorem

来源:互联网 发布:java云计算框架 编辑:程序博客网 时间:2024/05/21 13:56

addresss:http://acm.hdu.edu.cn/showproblem.php?pid=6124

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

code :

#include <iostream>#include <bits/stdc++.h>using namespace std;int main(){    int N;    scanf("%d",&N);    while (N--)    {        int x;        scanf("%d",&x);        x = (x+1)/2+1;        printf("%d\n",x);    }    return 0;}
原创粉丝点击