http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4106

题意:求大于等于n的最小可以被7整除不能被4整除的数

题解:预处理+二分

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum;
int a[N];
char str;
struct node{};
int main()
{
#ifdef DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout);
#endif//ios::sync_with_stdio(false);//cin.tie(0);//cout.tie(0);for(int i=1;i<1000;i++){if(i%7==0&&i%4!=0){a[++cnt]=i;}}//cout<<cnt<<endl;scanf("%d",&t);while(t--){scanf("%d",&n);cout<<a[lower_bound(a+1,a+cnt+1,n)-a]<<endl;}#ifdef DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}

Lucky 7 in the Pocket相关推荐

  1. The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

    Problem A Vertices in the Pocket 比赛地址:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?proble ...

  2. 基础算法 —— 模拟思维

    [概述] 模拟,是根据实际问题建立模型,模拟实际按程序走一遍,最终求出答案. 思维,则是与逻辑思维有关,其需要针对题意.数据范围等抽丝剥茧抽离出有用的信息,从而得出一个结果. 对于一般的模拟,直接根据 ...

  3. 【ZJCPC2019 第16届 浙江省赛】The 16th Zhejiang Provincial Collegiate Programming Contest(GFHIJ 5题)

    补题地址:https://zoj.pintia.cn/home/news 搜索16th 本文按照通过率补的题 G .Lucky 7 in the Pocket 题意:给出T个数,对于每个数,找出一个能 ...

  4. 考研英语 - word-list-31

    每天十个单词,本博客收集整理自<考研英语词汇>,仅供学习和个人积累. 新东方单词在线阅读地址 ,希望这个链接一直都有效 :) 2017年07月19日 22:16:38 consequent ...

  5. ZOJ18th省赛 Lucky 7

    [线上网址](http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=378) BaoBao has just found ...

  6. android 音频增益_参考级音频播放器!七彩虹发布Pocket HIFI U6:4999亲民价

    作为国产HiFi音频的老牌厂商,七彩虹去年年中推出了新旗舰播放器Pocket HIFI U8,时隔一年U系旗下第二款参考级播放器又来了,型号为"Pocket HIFI U6",将于 ...

  7. hihocoder 1152 Lucky Substrings

    #1152 : Lucky Substrings 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 A string s is LUCKY if and only if t ...

  8. 枚举 + 进制转换 --- hdu 4937 Lucky Number

    Lucky Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) T ...

  9. Ms Press China MVP-书评活动-王万利 Microsoft Active Directory Administrator's Pocket Consultant...

    [推荐]--Windows Server 2008,一本难得以求的好书<Microsoft Active Directory Administrator's Pocket Consultant& ...

最新文章

  1. Python3爬虫知识点总结
  2. php汉字转换拼音,PHP汉字转换拼音的函数代码
  3. 论文解读 | 基于神经网络的知识推理
  4. Python3--unitest框架的使用
  5. 传递对象_看懂Xlua实现原理——从宏观到微观(1)传递c#对象到Lua
  6. 使用 typescript ,提升 vue 项目的开发体验(1)
  7. WeakReference类详解
  8. 手机软件Toast无法显示提示信息
  9. css如何修改行内样式
  10. 计算机图形学(裁剪)
  11. 迷你西游最新服务器是哪个,《迷你西游》新开服务器公告
  12. 【第3版emWin教程】第57章 emWin6.x的炫酷时钟表盘设计,结合硬件RTC
  13. 云免停机卡免流服务器监控
  14. 资源管理框架(mesos/YARN/coraca/Torca/Omega)选型分析
  15. java飘落的雪花_[Java教程]树叶飘落、雪花飘落等同时多个图片飘落
  16. 高等数学(第七版)同济大学 习题12-7 个人解答
  17. ubuntu更改更新源
  18. fpga配置过程(转载)
  19. a1 抛光等级spi_SPI美国标准(抛光等级)
  20. [Wi-Fi抓包篇]1. Omnipeek——抓包前准备工作

热门文章

  1. if break语句_8、嵌套if语句、switch语句
  2. python序列类型唯一的映射类型_python2.x学习笔记(8)-映射和集合类型
  3. 00018计算机应用基础2019年4月,2019年4月自考计算机应用基础考前试题和答案00018.pdf...
  4. 服务器无显示器,服务器无显示器 远程桌面
  5. oracle触发器 select into,Oracle触发器中selectinto报错no_data_found异常处理
  6. vue修改html片段的样式无效,vue 组件中添加样式不生效的解决方法
  7. 型热电偶阻值温度对照表_如何选用温度传感器
  8. java怎么给类中的私有变量赋值_Java核心技术笔记分享------第二章 类与对象
  9. 使用jieba 提取 关键词
  10. 微信小程序学习笔记(六)