hdu 6124 Euler theorem (多校联赛)

来源:互联网 发布:java项目视频20套 编辑:程序博客网 时间:2024/06/05 22:48

Euler theorem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0


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
213
 

Sample Output
23

这场比赛里最简单的题目 我以为是数论 就扔给了队友 结果队友wr了两次 后来一看就是一道简单的思维题 忍不住很很的吐槽一波队友O__O "…

ac代码:

#include<cstdio>#include<iostream>using namespace std;int main(){    int t;    cin>>t;    int n;    while(t--)    {        scanf("%d",&n);        if(n==1)            cout<<2<<endl;        if(n==2)            cout<<3<<endl;        if(n!=1&&n!=2)        {            if(n&1)            {                cout<<(n+1)/2+1<<endl;            }            else            {                cout<<n/2+1<<endl;            }        }    }    return 0;}


原创粉丝点击