• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

  • 联系
  • 订阅
  • 管理

View Post

ZOJ 1712 Skew Binary

简单题

Skew Binary
1 #include<iostream>
2 #include<string>
3 #include<cmath>
4  using namespace std;
5
6 int main()
7 {
8 string a;
9 long num = 0;
10 int count = 1;
11 // freopen("test.txt", "r", stdin);
12 while (cin >> a && a != "0")
13 {
14 for (int i = a.length() - 1; i >= 0; i--)
15 {
16 num += (a[i] - '0')* (pow ((double)2, count++) - 1 );
17 }
18 cout << num << endl;
19 num = 0;
20 count = 1;
21 }
22
23 return 0;
24 }

 

posted on 2010-09-10 09:16  sysuwhj  阅读(227)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3