题目:

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.

题意:给出一个数N,找有多少个数,这些数的大小小于2N,且这些数符合2k-1的形式。

思路:把100以内的这种数和对应的N输出出来,会发现个数与N是成三倍的关系的。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
using namespace std;
vector<long double> v;int read()
{int res = 0;char op = getchar();if(op>='0' && op<='9'){res = op-'0';op = getchar();}while(op>='0'&&op<='9'){res = res*10+op-'0';op = getchar();}return res;
}
int main()
{int T,n,cnt=1;T = read();while(T--){int n;n = read();printf("Case #%d: %d\n",cnt++,n/3);}return 0;
}

View Code

转载于:https://www.cnblogs.com/sykline/p/9747475.html

Number Theory Problem(The 2016 ACM-ICPC Asia China-Final Contest 找规律)相关推荐

  1. 2016 ACM / ICPC Asia dalian Regional Contest 题解(11 / 11)【每日亿题2021 / 2 / 17】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A .(2017 ACM ICPC dalian H)To begin or not to be ...

  2. 2016 ACM ICPC Asia Region - Tehran

    2016 ACM ICPC Asia Region - Tehran A - Tax 题目描述:算税. solution 模拟. B - Key Maker 题目描述:给出\(n\)个序列,给定一个序 ...

  3. 2016 ACM/ICPC Asia Regional Shenyang Online

    I:QSC and Master 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5900 题意: 给出n对数keyi,vali表示当前这对数的键值和权值 ...

  4. 2016 ACM/ICPC Asia Regional Qingdao Online 1005 Balanced Game

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5882 Problem Description Rock-paper-scissors is a ze ...

  5. 2016 ACM/ICPC Asia Regional Dalian Online

    1009 Sparse Graph(hdu5876) 由于每条边的权值都为1,所以最短路bfs就够了,只是要求转置图的最短路,所以得用两个set来维护,一个用来存储上次扩散还没访问的点,一个用来存储这 ...

  6. Hdu 5873 2016 ACM/ICPC Asia Regional Dalian Online 1006(兰道定理)

    题解: 如果没有平手选项, 赢得加一分的话, 可以用Landau's Theorem(兰道定理)判定. 稍微修改一下这个定理就能做了. 假设S1,S2--,Sn是他们的得分序列,从小到大排个序.那么这 ...

  7. [Contests]2016 ACM/ICPC Asia Regional Dalian Online(1006/7/8/9)

    1006 Football Games 题意: 每组球队中有若干个队伍,每两个队伍之间比赛,胜得2分,负得0分,平局得1分: 然后判断题目给出的每组队伍得分是否合理,若合理输出"T" ...

  8. 2017 ACM ICPC Asia Shenyang Regional Contest 题解(10 / 13)【每日亿题2 / 16】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A.(2017 ICPC shenyang I)Little Boxes B.(2017 ICP ...

  9. Problem 1002-2017 ACM/ICPC Asia Regional Shenyang Online

    网络赛:2017 ACM/ICPC Asia Regional Shenyang Online 题目来源:cable cable cable Problem Description: Connecti ...

  10. The 36th ACM/ICPC Asia Regional Dalian Site 1006 Dave

    Dave Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65768/65768K (Java/Other) Total Submissi ...

最新文章

  1. assign 可以修饰对象吗
  2. 【PAT乙级】1025 反转链表 (25 分)
  3. Object-c 类、对象方法
  4. XML解析(二),DOM解析XML
  5. c调python_应该是史上最全的python调用C接口
  6. JSP 语法2 都在百分号里面: 5.@符号加JSP三种指令标签 6
  7. Android Studio的使用(四)--生成Get、Set方法
  8. 深度学习_pytorch_深度学习中的tensor介绍及常用操作
  9. arm linux dma 编程 request_dma,Linux驱动技术技术之一:DMA编程
  10. PaddleSeg用于人像分割
  11. 谢菲尔德大学的MATLAB遗传算法工具箱(附代码文件)
  12. Labview 做二维码识别
  13. win10cmd计算机管理界面,Win10命令提示符cmd在哪 Win10以管理员身份运行方法
  14. DataBufferLimitException: Exceeded limit on max bytes to buffer :262144
  15. ASP.NET通用房屋租赁管理系统源码
  16. 网页配色网页设计常用色彩搭配表 《配色表》
  17. 智课雅思词汇---十一、spect是什么意思
  18. Maxwell参数化建模
  19. 线性代数【10】 相似矩阵
  20. 10 本 O'Reilly 出版的免费好书

热门文章

  1. 【线上直播】深度学习简介与落地实战经验分享
  2. Faiss优化:针对OMP_NUM_THREADS环境变量设置的测试验证
  3. BZOJ4066:简单题(K-D Tree)
  4. autocomplete=off inpu属性
  5. C++ 复制构造函数
  6. org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:no sessi
  7. Android Studio删除无用的资源
  8. android 决TextView中MaxLines与ellipsize=end冲突问题
  9. android 格式化代码
  10. Android清单AndroidManifest详细说明