ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1225. Флаги

masoumeh please help [5] // Задача 1225. Флаги 1 апр 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;
}
luka Re: please help [1] // Задача 1225. Флаги 27 янв 2017 17:57
#include<iostream>
using namespace std;
int n, m;
int main()
{
    cin>>n
    cout<<n+1;
    return 0;
    }
try this
ToadMonster Re: please help // Задача 1225. Флаги 27 янв 2017 19:49
Note: luka didn't receive AC. Solution looks ... weird.
ToadMonster Re: please help // Задача 1225. Флаги 27 янв 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.
DailinHu Re: please help [1] // Задача 1225. Флаги 25 фев 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.
Grandmaster Re: please help // Задача 1225. Флаги 28 окт 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