码迷,mamicode.com
首页 > 其他好文 > 详细

A - Euler theorem

时间:2017-09-23 00:13:09      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:blog   different   return   writer   XML   line   http   als   ios   

2017-09-22 21:59:43

writer:pprp

HazelFan is given two positive integers a,ba,b, and he wants to calculate amodbamodb. But now he forgets the value of bb and only remember the value of aa, please tell him the number of different possible results.

InputThe first line contains a positive integer T(1T5)T(1≤T≤5), denoting the number of test cases. 
For each test case: 
A single line contains a positive integer a(1a109)a(1≤a≤109).
OutputFor each test case: 

A single line contains a nonnegative integer, denoting the answer. 

Sample Input

2
1
3

Sample Output

2
3
#include<iostream>
#include<string.h>
#include<stdlib.h>

using namespace std;

int main()
{
    int i,n;
    cin>>n;
    for(i = 0;i<n;++i)
    {
        int x;
        cin>>x;
        if(x%2==0)
        {
            cout<<(x/2)+1<<endl;
        }
        else if(x%2 == 1)
        {
            x++;
            cout<<(x/2)+1<<endl;
        }
    }
    return 0;
}

 

A - Euler theorem

标签:blog   different   return   writer   XML   line   http   als   ios   

原文地址:http://www.cnblogs.com/pprp/p/7577366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!