2017-09-22 21:59:43

writer:pprp

HazelFan is given two positive integers a, please tell him the number of different possible results.

InputThe first line contains a positive integer 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;
}

 

相关文章:

  • 2021-08-06
  • 2021-11-14
  • 2022-02-22
  • 2021-06-18
  • 2022-12-23
  • 2022-02-11
  • 2018-08-17
猜你喜欢
  • 2021-10-14
  • 2021-09-28
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
相关资源
相似解决方案