题解:

  因为每一位只可能是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. [LOJ113] 最大异或和 - 线性基

    虽然是SB模板但还真是第一次手工(然而居然又被运算符优先级调戏了) #include <bits/stdc++.h> using namespace std; #define int lo ...

  2. FPM 0.08不能运行破解办法……

    FPM_0.080.rar 破解办法:用UltraEdit打开FPM.exe,查找"33 C0 E9 F2"(注意中间有空格)将33改为8B,F2改为00

  3. Allegro 反射仿真--仿真设置

    一.打开BRD文件 打开PCB SI,启动Cadence Product Choices界面,如图1-1所示,一般我们选择Allegro PCB SI 630(SPECCTRAQuest),具体如下图 ...

  4. 11g RAC添加用户表空间(数据文件)至文件系统(File System)的修正

    前提:非TEMP.UNDO和SYSTEM表空间,这仨是大爷,您得搂着点.来自博客园AskScuti .客户是添加临时表空间数据文件时,不小心 ADD 到了文件系统中,然后发现,后悔了,还在OS层面 R ...

  5. wap网站开发小记(转载)

    一:网页的一些标记 1:声明 <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http ...

  6. 将java字节自动转为"B", "KB", "MB", "GB", "TB"等

    //字节转换 public static String readableFileSize(long size) { if (size <= 0) return "0"; fi ...

  7. js/jquery加入的select value显示不正确问题

    最近有需求,通过js添加select到表格中,虽然通过append加入的代码中select的value为2 但是实际显示出来的结果不对,百度之后没有找到答案,自己想了个办法 var selects = ...

  8. selenium的定位方法-多元素定位

    在实际工作中,有些时候定位元素使用ID.NAME.CLASS_NMAE.XPATH等方法无法定位到具体元素,会发现元素属性有很多一致的,这个时候使用单元素定位方法无法准确定位到具体元素,例如,百度首页 ...

  9. unittest学习5-断言

    unittest提供了以下断言方式: 方法 检查 新进 assertEqual(a, b) a == b   assertNotEqual(a, b) a != b   assertTrue(x) b ...

  10. chrome firefox浏览器屏蔽百度热搜

    我是原文 操作 点击拦截元素,然后选择页面元素,添加