HDU

来源:互联网 发布:用工作站玩游戏知乎 编辑:程序博客网 时间:2024/06/01 22:12

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6124

题目大意:知道a,不知道b,求a%b结果的所有可能的数量

解题思路:取7和8,然后写一下,发现b取a的一半以上就能把所有答案取遍

AC代码:

#include<cstdio>using namespace std;int main(){    int t;scanf("%d", &t);    while (t--)    {        int n;scanf("%d", &n);        printf("%d\n", (n + 1) / 2 + 1);    }    return 0;}
原创粉丝点击