Problem A. Number Theory Problem

Solved.

水。

 1 #include<bits/stdc++.h>
 2 
 3 using namespace std;
 4 
 5 const int maxn = 1e5 + 10;
 6 
 7 typedef long long ll;
 8 
 9 int n;
10 ll arr[maxn], ans[maxn];
11 
12 void Init()
13 {
14     arr[0] = 1;
15     for(int i = 1; i <= maxn; ++i)
16     {
17         arr[i] = (arr[i - 1] * 2) % 7;
18         ans[i] = ans[i - 1];
19         if(arr[i] == 1) ans[i]++;    
20     }
21 }
22 
23 int main()
24 {
25     Init();
26     int t;
27     scanf("%d",&t);
28     for(int cas = 1; cas <= t; ++cas)
29     {
30         scanf("%d", &n);
31         printf("Case #%d: %lld\n", cas, ans[n]);
32     }
33     return 0;
34 }
View Code

相关文章:

  • 2021-11-26
  • 2021-07-12
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2021-08-12
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-07-11
  • 2021-07-26
  • 2022-02-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案