见:https://blog.csdn.net/dormousenone/article/details/75208903

 #define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#include <cstdio>//sprintf islower isupper
#include <cstdlib>//malloc exit strcat itoa system("cls")
#include <iostream>//pair
#include <fstream>//freopen("C:\\Users\\13606\\Desktop\\草稿.txt","r",stdin);
#include <bitset>
//#include <map>
//#include<unordered_map>
#include <vector>
#include <stack>
#include <set>
#include <string.h>//strstr substr
#include <string>
#include <time.h>//srand(((unsigned)time(NULL))); Seed n=rand()%10 - 0~9;
#include <cmath>
#include <deque>
#include <queue>//priority_queue<int, vector<int>, greater<int> > q;//less
#include <vector>//emplace_back
//#include <math.h>
//#include <windows.h>//reverse(a,a+len);// ~ ! ~ ! floor
#include <algorithm>//sort + unique : sz=unique(b+1,b+n+1)-(b+1);+nth_element(first, nth, last, compare)
using namespace std;//next_permutation(a+1,a+1+n);//prev_permutation
#define fo(a,b,c) for(register int a=b;a<=c;++a)
#define fr(a,b,c) for(register int a=b;a>=c;--a)
#define mem(a,b) memset(a,b,sizeof(a))
#define pr printf
#define sc scanf
#define ls rt<<1
#define rs rt<<1|1
typedef long long ll;
#define rint register int;
void swapp(int &a,int &b);
double fabss(double a);
int maxx(int a,int b);
int minn(int a,int b);
int Del_bit_1(int n);
int lowbit(int n);
int abss(int a);
//const long long INF=(1LL<<60);
const double E=2.718281828;
const double PI=acos(-1.0);
const int inf=(<<);
const double ESP=1e-;
const int mod=(int)1e9+;
const int N=(int)1e6+; ll ans[];
char s[N];
ll get(int l)
{
ll sum=;
for(int i=;i<=l;++i)
sum*=,sum+=s[i]-'';
return sum;
} int main()
{
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
ans[]=;
while(~sc("%s",s+))
{
int l=strlen(s+);
if(l>)
pr("83 1111111110\n");
else
{
ll t=get(l);
for(int i=;i<=;++i)
{
if(i==||t<ans[i+])
{
pr("%d %lld\n",i,ans[i]);
break;
}
}
}
}
return ;
} /**************************************************************************************/ int maxx(int a,int b)
{
return a>b?a:b;
} void swapp(int &a,int &b)
{
a^=b^=a^=b;
} int lowbit(int n)
{
return n&(-n);
} int Del_bit_1(int n)
{
return n&(n-);
} int abss(int a)
{
return a>?a:-a;
} double fabss(double a)
{
return a>?a:-a;
} int minn(int a,int b)
{
return a<b?a:b;
}

1-N(1的总数)找规律的更多相关文章

  1. LightOJ 13361336 - Sigma Function (找规律 + 唯一分解定理)

    http://lightoj.com/volume_showproblem.php?problem=1336 Sigma Function Time Limit:2000MS     Memory L ...

  2. HDU 3032 (SG打表找规律)

    题意: 有n堆石子,alice先取,每次可以选择拿走一堆石子中的1~x(该堆石子总数) ,也可以选择将这堆石子分成任意的两堆.alice与bob轮流取,取走最后一个石子的人胜利. 思路: 因为数的范围 ...

  3. hdu 2604 Queuing dp找规律 然后矩阵快速幂。坑!!

    http://acm.hdu.edu.cn/showproblem.php?pid=2604 这题居然O(9 * L)的dp过不了,TLE,  更重要的是找出规律后,O(n)递推也过不了,TLE,一定 ...

  4. 找规律/贪心 Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones

    题目传送门 /* 找规律/贪心:ans = n - 01匹配的总数,水 */ #include <cstdio> #include <iostream> #include &l ...

  5. hdu 3951 - Coin Game(找规律)

    这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就 ...

  6. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  7. hdu4952 Number Transformation (找规律)

    2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...

  8. CF456B Fedya and Maths 找规律

    http://codeforces.com/contest/456/problem/B CF#260 div2 B Fedya and Maths Codeforces Round #260 B. F ...

  9. hdu 4731 2013成都赛区网络赛 找规律

    题意:找字串中最长回文串的最小值的串 m=2的时候暴力打表找规律,打表可以用二进制枚举

  10. 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake

    题目传送门 /* 水题 找规律输出 */ #include <cstdio> #include <iostream> #include <cstring> #inc ...

随机推荐

  1. oracle面试题1

    1.题目要求 已知关系模式:S (SNO,SNAME)学生关系.SNO 为学号,SNAME 为姓名C (CNO,CNAME,CTEACHER)课程关系.CNO 为课程号,CNAME 为课程名,CTEA ...

  2. 【零基础】搞懂GPU为什么比CPU“快”

    一.前言 近几年深度学习在各领域大显神威,而”GPU加速"也得到了越来越多的篇幅,似乎任何程序只要放到GPU上运行那速度就是杠杠的.GPU代替CPU计算已成了大势所趋?我先告诉你结论”那是不 ...

  3. phpstorm配置了git后Terminal 不能使用显示:git' 不是内部或外部命令,也不是可运行的程序

    问题:在phpstorm上配置好git后,将代码拉了下来 ,但是命令行无法使用显示如图 解决方法:①找到安装git的位置,然后在该目录的子目录下分别找到git-core.bin 两个目录,我的安装在了 ...

  4. Go语言中new和make的区别

    Go语言中new跟make是内置函数,主要用来创建分配类型内存. new( ) new(T)创建一个没有任何数据的类型为T的实例,并返回该实例的指针: 源码解析 func new func new(T ...

  5. Nginx URL重写(rewrite)配置及信息详解

    URL重写有利于网站首选域的确定,对于同一资源页面多条路径的301重定向有助于URL权重的集中 Nginx URL重写(rewrite)介绍 和apache等web服务软件一样,rewrite的组要功 ...

  6. Docker监控:最佳实践以及cAdvisor和Prometheus监控工具的对比

    在DockerCon EU 2015上,Brian Christner阐述了“Docker监控”的概况,分享了这方面的最佳实践和Docker stats API的指南,并对比了三个流行的监控方案:cA ...

  7. <linux-sed> sed基本用法

    1.简介 sed全称是Stream Editor,是非交互式的编辑器.它不会修改原文件,除非使用shell重定向来保存结果, 或者可以指定-i选项来在线修改文件,这样就会改变原文件,升级脚本通常用-i ...

  8. OpenCV画图(画OpenCV的标志)

    import numpy as np import cv2 img = np.ones((512, 512, 3), np.uint8)*255 # 画椭圆 # 图片 (圆心) (短轴长,长轴长),旋 ...

  9. GB、GBDT、XGboost理解

    GBDT和xgboost在竞赛和工业界使用都非常频繁,能有效的应用到分类.回归.排序问题,虽然使用起来不难,但是要能完整的理解还是有一点麻烦的.本文尝试一步一步梳理GB.GBDT.xgboost,它们 ...

  10. 什么是vue生命周期和生命周期钩子函数?

    原文地址 vue生命周期简介 咱们从上图可以很明显的看出现在vue2.0都包括了哪些生命周期的函数了. 生命周期探究 对于执行顺序和什么时候执行,看上面两个图基本有个了解了.下面我们将结合代码去看看钩 ...