Gym 101194A Number Theory Problem 打表、找规律

Problem A. Number Theory Problem
Time limit: 1 second

Mr. Panda is one of the top specialists on number theory all over the world.
Now Mr. Panda is investigating the property of the powers of 2. Since 7 is the lucky number of
Mr. Panda, he is always interested in the number that is a multiple of 7.
However, we know that there is no power of 2 that is a multiple of 7, but a power of 2 subtracted
by one can be a multiple of 7. Mr. Panda wants to know how many positive integers less than 2N
in the form of 2k − 1 (k is a positive integer) that is divisible by 7. N is a positive interger given
by Mr Panda.

Input
The first line of the input gives the number of test cases, T. T test cases follow.
Each test case contains only one positive interger N.

Output
For each test case, output one line containing “Case #x: y”, where x is the test case number
(starting from 1) and y is the answer.

Limits
• 1 ≤ T ≤ 100.
• 1 ≤ N ≤ 105

Sample Input
2
1
4

Sample Output

Case #1: 0
Case #2: 1

#include<bits/stdc++.h>
#define LLU unsigned long long
using namespace std;


int main()
{

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r",stdin);
    freopen("out.txt", "w",stdout);
#endif // ONLINE_JUDGE

    int T;
    cin >> T;
    int N;
    for(int t = 1; t <= T; t++)
    {
        cin >> N;
        LLU cnt = 0;
        LLU num;
        for(int i = 1; i <= N ;i++)
        
            
          if(i % 3 == 0) cnt++;
        
        printf("Case #%d: %d
", t, cnt);
    }

}
原文地址:https://www.cnblogs.com/YY666/p/11225314.html