2017.8.15杭电多校训练 Problem - 1005 Euler theoremt(杭电多校签到题)

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(1T5), denoting the number of test cases.
For each test case:
A single line contains a positive integer  a(1a109).
 

Output
For each test case:
A single line contains a nonnegative integer, denoting the answer.
 

Sample Input
 
  
2 1 3
 

Sample Output
 
  
2 3
分析:
找规律,两个一组,前两个输出2,之后输出3,4,5依次递增。
  1. #include<bits/stdc++.h>  
  2. using namespace std;  
  3. int main()  
  4. {  
  5.     int t;  
  6.     cin>>t;  
  7.     while(t--)  
  8.     {  
  9.         long long a;  
  10.         cin>>a;  
  11.         if(a%2==0) cout<<a/2+1<<endl;  
  12.         else cout<<(a+1)/2+1<<endl;  
  13.     }  
  14.     return 0;  
  15. }  
 本文来自CSDN博客,转载请标明出处: http://blog.csdn.net/Dingle_Captain/article/details/77187745

猜你喜欢

转载自blog.csdn.net/zxy2016011117/article/details/77386771