迭代

每个数对应前面的一个数

  1. #include<stdio.h>
  2. #include<iostream>
  3. using namespace std;
  4. #define max 88
  5. long long s[max], n,p;
  6. char *first="T.T^__^";
  7. void Init()
  8. {
  9. s[]=;
  10. s[]=;
  11. int i;
  12. for(i=; i <= max; i++)
  13. s[i]=s[i-]+s[i-];
  14. }
  15. int getp()
  16. {
  17. int i=;
  18. while(n>s[i])
  19. i++;
  20. return i-;
  21. }
  22. int main()
  23. {
  24. Init();
  25. while(scanf("%lld",&n)!=EOF)
  26. {
  27. while(n>)
  28. {
  29. p=getp();
  30. n-=s[p];
  31. }
  32. cout<<first[n-]<<endl;
  33. }
  34. return ;
  35. }

ZOJ 1633的更多相关文章

  1. zoj 1633 Big String

    Big String Time Limit: 2 Seconds Memory Limit: 65536 KB We will construct an infinitely long string ...

  2. ZOJ People Counting

    第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ  3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...

  3. ZOJ 3686 A Simple Tree Problem

    A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each no ...

  4. ZOJ Problem Set - 1394 Polar Explorer

    这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...

  5. ZOJ Problem Set - 1392 The Hardest Problem Ever

    放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <std ...

  6. ZOJ Problem Set - 1049 I Think I Need a Houseboat

    这道题目说白了是一道平面几何的数学问题,重在理解题目的意思: 题目说,弗雷德想买地盖房养老,但是土地每年会被密西西比河淹掉一部分,而且经调查是以半圆形的方式淹没的,每年淹没50平方英里,以初始水岸线为 ...

  7. ZOJ Problem Set - 1006 Do the Untwist

    今天在ZOJ上做了道很简单的题目是关于加密解密问题的,此题的关键点就在于求余的逆运算: 比如假设都是正整数 A=(B-C)%D 则 B - C = D*n + A 其中 A < D 移项 B = ...

  8. ZOJ Problem Set - 1001 A + B Problem

    ZOJ ACM题集,编译环境VC6.0 #include <stdio.h> int main() { int a,b; while(scanf("%d%d",& ...

  9. zoj 1788 Quad Trees

    zoj 1788 先输入初始化MAP ,然后要根据MAP 建立一个四分树,自下而上建立,先建立完整的一棵树,然后根据四个相邻的格 值相同则进行合并,(这又是递归的伟大),逐次向上递归 四分树建立完后, ...

随机推荐

  1. jquery validation插件使用

    首先需要引入jQuery.js和jquery.validate.js 以下面代码为例: <form id="mainform"> <fieldset> &l ...

  2. CFont 字体类

    CFont 字体类 初始化函数 CreateFontIndirect 初始化一个由LOGFONT结构给出其特征的CFont对象 CreateFont 初始化用指定特性定义的CFont对象 Create ...

  3. 防止ajax非正常访问

    http://www.cnblogs.com/yagzh2000/archive/2013/06/09/3128042.html http://www.cnblogs.com/henw/archive ...

  4. no-cache、max-age=0、must-revalidate区别

    之前深入搜索了多次,根据stackoverflow的回答进行一些总结(http://stackoverflow.com/questions/18148884/difference-between-no ...

  5. LeetCode_Single Number II

    Given an array of integers, every element appears three times except for one. Find that single one. ...

  6. Cracking the coding interview--Q2.1

    原文: Write code to remove duplicates from an unsorted linked list.FOLLOW UPHow would you solve this p ...

  7. 读、写SD上的文件请按如下步骤进行

    1.调用Environment的getExternalStorageState()方法判断手机上是否插入了SD卡,并且应用程序具有读写SD卡的权限.例如使用如下代码//Environment.getE ...

  8. 使用 PIVOT 和 UNPIVOT 行转列 列转行 报表统计 函数

    官方文档:http://technet.microsoft.com/zh-cn/library/ms177410(v=SQL.105).aspx 可以使用 PIVOT 和 UNPIVOT 关系运算符将 ...

  9. css浮动+应用(瀑布流效果的实现)

    首先是index.html文件: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"& ...

  10. [Qt] Mask 蒙版

    [Qt] Mask 蒙版 Mask能够覆盖在其他的widget上面,实现一些动态图片的加载效果.下面给出代码. mask.h #ifndef MASK_HJ #define MASK_HJ #incl ...