Cod sursa(job #1253572)

Utilizator BrejeMihaiBreje Mihai BrejeMihai Data 1 noiembrie 2014 14:46:43
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <iostream>
#include <fstream>

#define N 100001

using namespace std;

long a,b,t;
int y;
int main()
{
    ifstream myFile;
    myFile.open("euclid2.in");
    myFile >> t;

    ofstream myFilee;
    myFilee.open("euclid2.out");

    for(long i=0; i<t; i++)
    {
        myFile >> a >> b;
        while(b!=0)
        {
            y=b;
            b=a%b;
            a=y;
        }
        myFilee << a << "\n";
    }


    myFile.close();
    myFilee.close();
    return 0;
}