而且还加入了大量的主题,直接或模板Java我们能够在水。

除了循环33它的时间,计算A99它是第几,输出准确回答。

#include <stdio.h>
#include <string>
#include <algorithm>
using std::string; const int MAX_B = 5120;
char buf[MAX_B];
int id = 0, len = 0; inline char getFromBuf()
{
if (id >= len)
{
len = fread(buf, 1, MAX_B, stdin);
id = 0;
}
return buf[id++];
} void getIntFromBuf(string &n)
{
char a = getFromBuf();
while ((a == ' ' || a == '\n') && len) a = getFromBuf(); n.clear();
while ((a != ' ' && a != '\n') && len)//老是写&&,错成||
{
n.push_back(a);
a = getFromBuf();
}
} string operator+(string &a, string &b)
{
string c;
int N1 = (int)a.size(), N2 = (int)b.size();
int carry = 0;
for (int i = N1-1, j = N2-1; i>=0 || j>=0 || carry; i--, j--)
{
int an = i>=0? a[i]-'0' : 0;
int bn = j>=0? b[j]-'0' : 0;
int sum = an + bn + carry;
carry = sum / 10;
c.push_back(sum % 10 + '0');
}
reverse(c.begin(), c.end());
return c;
} int main()
{
string a1, a2, a3;
while (true)
{
getIntFromBuf(a1);
if (len == 0) break;
getIntFromBuf(a2);
getIntFromBuf(a3); for (int i = 0; i < 33; i++)
{
string a = a2 + a3;
a1 = a1 + a;
if (i == 32) break;
a2 = a1 + a;
a3 = a3 + a1;
a3 = a3 + a2;
}
puts(a1.c_str());
}
return 0;
}

版权声明:笔者心脏靖,景空间地址:http://blog.csdn.net/kenden23/,可能不会在未经作者同意转载。

POJ 3982 序列 塔尔苏斯问题解决的更多相关文章

  1. Poj 3982 序列

    1.Link: http://poj.org/problem?id=3982 2.Content: 序列 Time Limit: 1000MS   Memory Limit: 65536K Total ...

  2. POJ 3982 序列(JAVA,简单,大数)

    题目 //在主类中 main 方法必须是 public static void 的,在 main 中调用非static类时会有警告信息, //可以先建立对象,然后通过对象调用方法: import ja ...

  3. UVA 10494-If We Were a Child Again(一流的塔尔苏斯)

    Problem C If We Were a Child Again Input: standard input Output: standard output  seconds   "Oo ...

  4. HDU - 5186 - zhx&#39;s submissions (精密塔尔苏斯)

    zhx's submissions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  5. hdu 2243 考研路茫茫——单词情结 ac自动机+矩阵快速幂

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=2243 题意:给定N(1<= N < 6)个长度不超过5的词根,问长度不超过L(L <23 ...

  6. PlantUML——2.中文乱码及解决

    关于中文 参见: http://plantuml.sourceforge.net/unicode.html   问题描述 第一步:创建demo03.txt描述文档: @startuml Alice - ...

  7. nhibernate实体类主键ID赋值问题

    有个同事忽然来找我,说他遇到了一个问题,在调用nhibernate 进行update数据的时候报错,说是有数据行锁定. 看代码,没啥问题. 直接在PL/SQL developer里对数据库进行插入,也 ...

  8. 2013 ACM/ICPC Asia Regional Changsha Online - J

    原题戳这里. 题意: 有一未知列数a1,a2,a3.....an, 已知s[i]=a[i-1]+a[i]+a[i]  (1<i<n) s[1]=a[1]+a[2]; s[n]=a[n-1] ...

  9. 把一个序列转换成非严格递增序列的最小花费 POJ 3666

    //把一个序列转换成非严格递增序列的最小花费 POJ 3666 //dp[i][j]:把第i个数转成第j小的数,最小花费 #include <iostream> #include < ...

随机推荐

  1. cf 323A A. Black-and-White Cube 立体构造

    A. Black-and-White Cube time limit per test 1 second memory limit per test 256 megabytes input stand ...

  2. hdu4670(树上点分治+状态压缩)

    树上路径的f(u,v)=路径上所有点的乘积. 树上每个点的权值都是由给定的k个素数组合而成的,如果f(u,v)是立方数,那么就说明f(u,v)是可行的方案. 问有多少种可行的方案. f(u,v)可是用 ...

  3. hdu 5073 Galaxy(2014acm鞍山亚洲分部 C)

    主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5073 Galaxy Time Limit: 2000/1000 MS (Java/Others)   ...

  4. 算法入门经典大赛 Dynamic Programming

    111 - History Grading LCS 103 - Stacking Boxes 最多能叠多少个box DAG最长路 10405 - Longest Common Subsequence ...

  5. STL顺序容器【vector】【deque】【list】

    我们都知道,stl在集装箱船分为两类,订购集装箱和相关的容器. 顺序容器有三种即动态数组vector,双端队列deque,以及链表list (对csdn的文字排版严重吐槽.写好的版发表了就变了) 一: ...

  6. 【JUnit4.10来源分析】0导航

    JUnit靠GOF 中的一个Erich Gamma和 Kent Beck 单元测试框架编写一个开源,yqj2065分析JUnit的主要目的是源 中学习对设计模式的运用. JUnit也是一个学习Java ...

  7. add-apt-repository

    也许你早已注意到,我们在介绍软件的时候,在安装这块一般都提供 PPA 源安装方式,这是一种快速方便的软件安装方法,但对于一些新手来说,对 PPA 并不是很熟悉,下面我们就详细介绍一下. # 我们先了解 ...

  8. tcpdump VS tshark用法(转)

    Tcpdump是网络协议分析的基本工具.tshark是大名鼎鼎的开源网络协议分析工具wireshark (原名叫ethereal)的命令行版本,wireshark可对多达千余种网络协议进行解码分析.W ...

  9. 怎么样putty打开图形化管理工具,在终端上

    有时需要在putty这种图形终端开放的图形化管理工具将出现以下错误: [root@node2 ~]# Traceback (most recent call last): File "/us ...

  10. Replace是替代 Split分割字符串

    Replace是替代 Split分割字符串string[] ReadText = str.Replace("\r\n", "@").Split('@'); Sp ...