ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1225. Flags

please help
Posted by masoumeh 1 Apr 2015 18:25
whats test12?
whats my cod problem?

//in the name of allah
#include<stdio.h>
int main()
{
    int x=2, y=2, z;
    int i,n;
    scanf("%d\n", &n);
    if (n == 1 || n == 2)
    {
        printf("%d\n", 2);
        return 0;

    }
    for (i = 3; i<= n; i++){
        z = x + y;
        x = y;
        y = z;

    }
    printf("%d\n", z);
    return 0;
}
Re: please help
Posted by luka 27 Jan 2017 17:57
#include<iostream>
using namespace std;
int n, m;
int main()
{
    cin>>n
    cout<<n+1;
    return 0;
    }
try this
Re: please help
Posted by ToadMonster 27 Jan 2017 19:49
Note: luka didn't receive AC. Solution looks ... weird.
Re: please help
Posted by ToadMonster 27 Jan 2017 19:55
1. It's better to help if author shows error (WA/TLE/etc) and test number.
2. int isn't enough. Try to use 64-bit variables.
Re: please help
Posted by DailinHu 25 Feb 2017 13:00
the problem is that when the input number comes to 45, even data type long long int cannot hold as big a result as 2269806340;(the result for 45), not to mention type int.
Re: please help
Posted by Grandmaster 28 Oct 2017 15:56
long long is enough, 2269806340 is about 2^31-32, long long is 2^64, so it is double in the number of digits