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.|

RGB7609 - Зальжин дараалал

a0=1, a1=1, a2n = an ­+ 1 (n>0), a2n+2 = a2n+1 - an (n>0) томьёогоор өгөгдсөн дарааллын n-р гишүүнийг ол.

Input

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

Output

Дарааллын n-р гишүүн.

Example

Input:
11

Output:
13

Нэмсэн: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-04-21 08:36:27
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,i;
cin>>n;
long long a[3000];
a[0]=1;
a[1]=1;
a[2]=2;
for(int i=2;i<=n;i++){
a[2*i]=a[i]+1;
a[2*i-1]=a[2*i]+a[i-1];
}
cout<<a[n];
}
2024-01-16 05:52:55
8===э diсk

Last edit: 2024-01-16 05:59:29
2024-01-16 05:48:29
Welcome to San Andreas, I'm CJ from Grove Street
Land of the heinous, gang bangers and cold heat
In Los Santos, neighbors get no sleep
Beefing with anybody competin', even police
Four deep in a green rag with gold feet
Blast wit' the flag on the strap, that's OG
Stay in shape, hit the gym, lift the weights
Get supercut and big and buff, nice and straight
You got stats: Respect, weapon skill
Stamina, muscle, fat and sex appeal
You get clothes from Binco, and ProLaps
Suburban, Zip, Victim and D-Sachs
Watch yo' back when them rival hoods
They'll test just to guess if your survival's good (Survival's good)
Duckin' shells at the Cluckin' Bell
Jump out, bus' a gun until they tuck they tail
It seems like I'm on impossible missions
Twisted predicaments, hostile positions
Tenpenny and Pulaski harass me
Cop cars been on our ass the last past week
Cause the 'Dreas's full of gangsters, homeboy
Hands is the language for the bangers, homeboy
And it's dangerous, homeboy
Get your brains 'fore how you do yo fingers, homeboy
Heat cocked, we poppin' hot ones, dump 'em out
Bend the block, shake before the cops come
Listen for sirens, they don't got none
Back another lap, catch a straggler with the shot gun
Hittin' them up, what that Grove Street like
In a dirty slingshot and old Levi's
2023-03-13 11:49:41
huul suguuuudaaa

Last edit: 2023-03-13 11:50:28
2022-01-27 19:02:18
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
long long a,n[10000],b=2,c,d;
int main()
{
scanf("%lld",&a);
n[0]=1;
n[1]=1;
n[2]=2;
while(b<=a)
{
n[2*b]=n[b]+1;
n[2*b-1]=n[2*b]+n[b-1];
b++;
}
printf("%lld",n[a]);
return 0;
}

n massivaa ali boloh iheer avj bgara hahah vnjii huuhdude <3
EDTS iin 11b iin huland hairtai shv hahahha<3
hervee eniiig unshij bval ci bol aimr hoorhn shv haha<3 <3damn
2022-01-22 12:38:00
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
long long way[3000];
way[0]=1;
way[1]=1;
way[2]=2;
for(int i=2;i<=n;i++){
way[2*i]=way[i]+1;
way[2*i-1]=way[2*i]+way[i-1];
}
cout<<way[n];
return 0;
}
2021-01-14 06:12:12
#include <iostream>

using namespace std;

int main(){
int n, i;
long long a[1005];
cin >> n;

a[0]=1;
a[1]=1;

for(i=2; i<=n; i++){
if(i % 2 == 0) a[i] = a[i / 2] + 1;
else a[i] = a[i / 2 + 1] + a[i / 2] + 1;

}
cout << a[n];
}
2020-11-07 05:15:36
#include<cstdio>
#include<cmath>

int main () {
long long a[10000];
int f,n,i,j,m,k;
scanf ("%d",&f);
a[0]=1;
a[1]=1;
for(i=1;i<=f;i=i+1){
a[2*i]=a[i]+1;
a[2*i+1]=a[i+1]+a[i]+1;
}
printf ("%d",a[f]);
return 0;
}
2020-10-21 14:50:12
#include<bits/stdc++.h>
using namespace std;
int main (){
long long g,i,e=0,k,q[3000],a,b;
cin>>a;
q[0]=1;
q[1]=1;
for(i=2; i<=a; i++){
if(i%2==0){
q[i]=q[i/2]+1;
}
if(i%2==1){
q[i]=q[i/2]+q[i/2+1]+1;
}
}
cout<<q[a];
}
2019-11-08 12:16:02
#include <cstdio>
int main(){
int a[1005];int n;
scanf("%d" , &n);
int a[0] = 0;
int a[1] = 0;
for(int i = 2;i<=n i++);
if(i%2==0){
a[i]=a[1/2]+a[i/2-1];
}else{
a[i]=a[i/2]-a[i/2-1];
}
}
printf("%d" , a[n]);
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.