Eva's Problem

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other)
Total Submission(s) : 78   Accepted Submission(s) : 32
Problem Description
Eva的家庭作业里有很多数列填空练习。填空练习的要求是:已知数列的前四项,填出第五项。因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习。
 
Input
第一行是数列的数目t(0 <= t <= 20)。以下每行均包含四个整数,表示数列的前四项。约定数列的前五项均为不大于10^5的自然数,等比数列的比值也是自然数。
 
Output
对输入的每个数列,输出它的前五项。
 
Sample Input
2 1 2 3 4 1 2 4 8
 
Sample Output
1 2 3 4 5 1 2 4 8 16
 
Source
PKU

 #include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
int T,a[],i;
scanf("%d",&T);
while(T--)
{
for(i=;i<;i++)
{
scanf("%d",&a[i]);
if(i>)
{
if((a[]+a[])==a[]*)
a[]=(a[]-a[])+a[];
else
a[]=(a[]/a[])*a[];
}
}
for(i=;i<;i++)
printf("%d ",a[i]);
putchar('\n');
}
return ;
}

Eva's Problem的更多相关文章

  1. OpenJudge/Poj 1658 Eva's Problem

    1.链接地址: http://bailian.openjudge.cn/practice/1658 http://poj.org/problem?id=1658 2.题目: 总时间限制: 1000ms ...

  2. poj 1658 Eva's Problem(水题)

    一.Description Eva的家庭作业里有很多数列填空练习.填空练习的要求是:已知数列的前四项,填出第五项.因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习. Inpu ...

  3. 算法之路 level 01 problem set

    2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...

  4. POJ解题经验交流

    感谢范意凯.陈申奥.庞可.杭业晟.王飞飏.周俊豪.沈逸轩等同学的收集整理.   题号:1003 Hangover求1/2+1/3+...1/n的和,问需多少项的和能超过给定的值 类似于Zerojudg ...

  5. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  6. POJ数据的输入输出格式

    POJ在评阅习题时需要向程序提供输入数据,并获取程序的输出结果.因此提交的程序需按照每个习题具体的输入输出格式要求处理输入输出.有的时候,测评系统给出程序的评判结果是“数据错误”或“结果错误”,有可能 ...

  7. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  8. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  9. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

随机推荐

  1. angularjs uigrid 中celltemplate的写浮动框

    columnDefs: [ {field: 'collegename', enableFiltering: false ,width:"12%",displayName:" ...

  2. hdu1010

    #include <stdio.h>#include <string.h>#include <math.h> int n,m,t;char map[10][10]; ...

  3. Java反序列化漏洞分析

    相关学习资料 http://www.freebuf.com/vuls/90840.html https://security.tencent.com/index.php/blog/msg/97 htt ...

  4. Gdevops2016年全球敏捷运维峰会【上海站】嘉宾阵容

    2016年全球敏捷运维峰会(Gdevops, Global Devops Summit)将于2016年在杭州.北京.广州.上海四城全面启动,本次峰会旨在搭建一个开发者与 运维者沟通交流的平台,围绕各种 ...

  5. Ubuntu 14.04 apt源更新

    # 14.04 下进 my /etc/apt/sources.list /etc/apt/sources.bak vi /etc/apt/sources.list 从以下源中选择一个 源列表 Trus ...

  6. php基础(五)日期

    PHP Date() 函数 date(format,timestamp) 参数 描述 format 必需.规定时间戳的格式. timestamp 可选.规定时间戳.默认是当前时间和日期. 注释:时间戳 ...

  7. 浏览器差异性hack

    1 js函数 很多人误以为数组 push 方法拼接字符串会比 += 快,要知道这仅仅是 IE6-8 的浏览器下. 实测表明现代浏览器使用 += 会比数组 push 方法快,而在 v8 引擎中,使用 + ...

  8. agnentX学习存在疑问?

    在RFC2741中这样定义: 4.3中有如下段落: A general architectural division of labor between master agent and  subage ...

  9. Docker安装目录

    操作系统为 # cat /etc/redhat-release CentOS Linux release (Core) docker安装 # yum install -y docker docker安 ...

  10. REST认识

    大家对REST的认识? 谈到REST大家的第一印象就是通过http协议的GET,POST,DELETE,PUT方法实现对url资源的CRUD(创建.读取.更新和删除)操作.比如http://www.a ...