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

what's wrong with that code :(
Posted by Bartosz 7 Jan 2010 23:47
#include <cstdlib>
#include <iostream>

//----------Funkcje----------------------------
long long nwd(long long a, long long b)
{
  if (b>=1) nwd(b, a%b);
  if (b=0) return a;
}


using namespace std;

//---------------Program------------------------------------
int main(int argc, char *argv[])
{
    int n;
    long long tab[1002]={0};
    //printf("Dla ilu liczb chcesz policzyc NWD?: \n");
    scanf("%d", &n);
    //printf("Podaj liczby: \n");
    for (int i=0;i<n;i++) scanf("%I64d", &tab[i]);
    long long wynik=tab[0];
    for (int i=0;i<n-1;i++) {
      wynik=nwd(tab[i],tab[i+1]);
      tab[i+1]=wynik;
    }

    //printf("NWD wynosi %I64d \n", wynik);
    printf("%I64d", wynik);

    system("PAUSE");
    return EXIT_SUCCESS;
}