题目链接:Uva传送门 CFGym传送门

 

UVALive7897 Number Theory Problem (找规律签到)

思路:

  8的幂次都是可以的,因为an-1一定能分解成a-1乘上一个多项式。

  看不出来也没关系,打表就发现每三个数有一个7的倍数。

代码:

#include <cstdio>

using namespace std;

int main()
{
    int T, kase = 1;
    scanf("%d", &T);
    while (T--) {
        int N;
        scanf("%d", &N);
        printf("Case #%d: %d\n", kase++, N/3);
    }

    return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2021-05-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2021-07-11
  • 2021-09-10
  • 2022-12-23
相关资源
相似解决方案