点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 金牌教程 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

From VijosGuest0
加速等式
背景 Background
  首届“科普杯”小学生网络程序设计邀请赛试题.
描述 Description
  加速等式(jsds.pas)
【问题描述】
已知s=2+2+3+5+8+12+17+...,求前n项时s的值。例如:n=4时,s=12;n=7时,s=49。
【输入文件】
只一行一个整数n(2<=n<=1000),表示前n项。
【输出文件】
只一行一个整数s,即数列前n项之和。
【输出样例】
输入:
7
输出:
49
【数据规模】
30%的数据,N<=10
50%的数据,N<=100
100%的数据,N<1000

输入格式 Input Format
  只一行一个整数n(2<=n<=1000),表示前n项。
输出格式 Output Format
  只一行一个整数s,即数列前n项之和。
样例输入 Sample Input
 
样例输出 Sample Output
 
时间限制 Time Limitation
  各个测试点1秒。
注释 Hint
  Free Pascal Code:
-------------------
program Plus;
var a,b:longint;
begin
 readln(a,b);
 writeln(a+b);
end.

C++ Code:
-------------------
#include <iostream>
using namespace std;
int main(){
 int a,b;
 cin>>a>>b;
 cout<<a+b<<endl;
 return 0;
}
Flag
  
题号
  P1038
  其它
通过
  55人
提交
  119次
通过率
  46%
难度
  0
提交 讨论 题解
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1242 | Online Users / Processes : 0 / 59 | Processed Time : 95 ms | Server Time : 2025/4/27 1:15:12