题解:

  因为每一位只可能是4或者7,可以类比二进制的思想。

  基数为2,每一位的权值为2i-1;数字4表示的大小为1*2i-1;数字7表示的大小为2*2i-1

  将给定的n按照这种方法进行分解,求和。即为答案。

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std; int main(){
int n;
while(~scanf("%d",&n)){//二进制的思想
int ans=;
int index=;
while(n){
if(n%==)ans+=index;
else if(n%==)ans+=*index;
n/=;
index*=;
}
printf("%d\n",ans);
} return ;
}

数制的运用-CodeForces - 535B的更多相关文章

  1. Codeforces 535B Tavas and SaDDas 水题一枚

    题目链接:Tavas and SaDDas Once again Tavas started eating coffee mix without water! Keione told him that ...

  2. Codeforces Round #299 (Div. 2)【A,B,C】

    codeforces 535A-水题: #include <bits/stdc++.h> using namespace std; typedef long long LL; char s ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. Learning to See in the Dark论文阅读笔记

    这是一篇图像增强的论文,作者创建了一个数据集合,和以往的问题不同,作者的创建的see in the dark(SID)数据集合是在极其暗的光照下拍摄的,这个点可以作为一个很大的contribution ...

  2. Mahmoud and Ehab and the message

    Mahmoud wants to send a message to his friend Ehab. Their language consists of n words numbered from ...

  3. 融e学 一个专注于重构知识,培养复合型人才的平台【获取考试答案_破解】

    考试系统-融e学-一个专注于重构知识,培养复合型人才的平台.[获取答案] ganquanzhong 背景:今天去完成学校在融e学上开设的必修课和选修课考试,由于自己的时间有限(还有其他的事情要去做). ...

  4. 【转载】Hive vs HBase

    转自:http://www.chinastor.com/a/hbase/0G3Z532014.html Hive是什么? Apache Hive是一个构建于Hadoop(分布式系统基础架构)顶层的数据 ...

  5. OpenGL基本图元类型

    GL_POINTSGL_LINESGL_LINE_STRIPGL_LINE_LOOPGL_TRIANGLESGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_QUADSGL_QUA ...

  6. JQ 遍历--(祖先,后代,同胞,过滤)

    祖先 <style> .one,.one *{ display: block; border: 2px solid lightgrey; color: lightgrey; padding ...

  7. AE(ArcGIS Engine)的安装与配置(附加ArcGIS安装及所需安装包)

    https://blog.csdn.net/qq_38281942/article/details/82534279

  8. 从bbs.3dmgame.com与qq的登录解析oauth2.0协议

    点击3dm上的qq图标,浏览器跳转到,地址为: https://graph.qq.com/oauth2.0/show ?which=Login &display=pc &respons ...

  9. DBContext基础查询

    https://www.cnblogs.com/gosky/p/5752001.html 遍历所有实体 //遍历所有学生 DBSet using (var db = new Entities()) { ...

  10. java项目中的异常处理总结

    异常指的是运行期出现的错误,也就是当程序开始执行以后执行期出现的错误.出现错误时观察错误的名字和行号最为重要. 比如你读取的文件不存在,数组越界,进行除法时,除数为0等都会导致异常. 我找一个比较形象 ...