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

HDU 6124 17多校7 Euler theorem(简单思维题)

时间:2017-08-16 11:30:09      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:简单   sub   ==   put   content   pac   color   input   多校7   

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
 
题意:有两个正整数a,b。a已知,b未知,求a mod b有几种情况
题解:手算几个即可发现规律。以7为例,有如下5种情况 7(b>7),1(b==6||b==3||b==2),2(b==5),3(b==4),0(b==1||b==7);

 

 1 #include<iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 
 5 int T;
 6 long long a;
 7 int main()
 8 {
 9     scanf("%d",&T);
10     while(T--)
11     {
12         scanf("%lld",&a);
13         printf("%lld\n",(a+1)/2+1);
14     }
15     return 0;
16 }

 

HDU 6124 17多校7 Euler theorem(简单思维题)

标签:简单   sub   ==   put   content   pac   color   input   多校7   

原文地址:http://www.cnblogs.com/Annetree/p/7371845.html

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