题解:

  因为每一位只可能是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. 对象Bean与Map互转问题

    一.摘要 在实际开发过程中,经常碰到需要进行对象与map之间互转的问题,其实对于对象.Map 之间进行互转有很多种方式,下面我们一起来梳理一下: 利用 JSON 工具包,将对象转成字符串,之后再转成 ...

  2. Big research problems (1)

    1. how to measure the uncertainty of prediction model or data analysis? 2.

  3. U盘拷贝目标文件过大无法复制时的解决方法

    在cmd下输入:convert U盘符:/fs:ntfs    --->  回车 转换完成后可以看到U盘属性为NTFS了 这时就可以复制大文件到U盘了

  4. 关于Win32串口

    因为近段时间接触Hid相对来说多一些,由此忽略了串口中获取cbInQue这个重要的东西,下面是错误代码 // Win32SerialPortLib.cpp : 定义 DLL 应用程序的导出函数. // ...

  5. SpringCloud Netflix Hystrix

    Hystrix的一些概念 Hystrix是一个容错框架,可以有效停止服务依赖出故障造成的级联故障. 和eureka.ribbon.feign一样,也是Netflix家的开源框架,已被SpringClo ...

  6. web-css-文本

    一.文本的水平对齐方式 使用text-align来设置文本的对齐方式:text-align的取值:left(向左对齐)/center(水平居中对齐)/right(向右对齐)/justify(两端对齐) ...

  7. ASP.NET + MVC5 入门完整教程四---MVC 中使用扩展方法

    https://blog.csdn.net/qq_21419015/article/details/80433640 1.示例项目准备1)项目创建新建一个项目,命名为LanguageFeatures ...

  8. sql避免科学计数法并保留两位小数

    SELECT trim(to_char(), ), ,), '9999,999,990.00')) AS CAvgPrice FROM POSITION a 结果: 以trim(to_char(ROU ...

  9. ansible笔记(2):管理清单配置详解

    前情提要:管理清单(Iventory)配置文件/etc/ansible/hosts.通过修改该配置文件以达到管理受控主机的目的.    在我的实验平台上有3台主机:192.168.232.181(an ...

  10. analog filter

    理想的filter如下: 但是实际的filter如下: 在实际应用中,我们更多的是用Fo和Q这两个parameter来design analog filter. Low-Pass Filter tra ...