Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7606 - Фибоначчийн n дахь гишүүн

F1=1, F2=1, Fn=Fn-1+Fn-2 томьёо өгөгдсөн бол n-р гишүүнийг ол.

Input

Натурал тоо өгөгдөнө. 1<=n<=45.

Output

Fn

Example

Input:

3

Output:

2


Нэмсэн:Bataa
Огноо:2013-01-24
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2024-05-17 06:05:44
#include<stdio.h>
int main(){
int b=0,c,d=0,s,n;
scanf("%d",&n);
int a[n];
a[1]=1;
a[2]=1;
for(int i=3;i<=n;i++){
a[i]=a[i-1]+a[i-2];
}
printf("%d",a[n]);
}
nasaara talarh nigger lalruudaa
2024-01-20 07:44:18
Nigger sda ve ?
2023-12-13 09:31:09
#include<bits/stdc++.h>
using namespace std;

int fib(int n) {
if(n<=1){
return n;
}else{
return fib(n-1)+fib(n-2);
}
}
main(){
int n, c;
cin>>n;
c=fib(n);
cout<<c;
}
2023-12-05 06:36:49
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;
int main() {
int a[100];
int i, n, s;

cin >> n;
a[1] = 1;
a[2] = 1;
for (i = 3; i <= n; i++) {
a[i] = a[i - 1] + a[i - 2];
}
cout << a[n] << endl;
return 0;
}
2023-11-07 07:14:33
#include <iostream>
#include <cmath>

using namespace std;

int main() {
int a[46];
int i, n, x;

cin >> n;
a[1] = 1;
a[2] = 1;
for (i = 3; i <= n; i++) {
a[i] = a[i - 1] + a[i - 2];
x = a[i];
}
cout << x << endl;
return 0;
}
zov bizde llr

Last edit: 2023-11-07 07:14:52
2023-05-24 04:52:37
EZZZZZ
2022-09-23 01:32:29
Scanner scan = new Scanner (System.in);
boolean f=true;
int nu1=0;
while(f)
{System.out.print("A=");
nu1 = scan.nextInt();
if(1<=nu1&&nu1<=45)
f=false;
else
{
System.out.print("1<=n<=45!");}
}
int arr[]=new int[100000];
int a1=0,b=nu1-1,c=nu1-2;
for(int i=0;i<=(nu1-1);i++)
{
int a=1;
arr[i]=a;
}
a1=arr[b]+arr[c];
System.out.print(a1);
2022-05-26 02:21:56
EZZZZZ
2022-05-26 02:21:56
EZZZZZ
2022-05-26 02:21:56
EZZZZZ
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.