834 - Continued Fractions

#include<stdio.h>
#include<vector>
using namespace std;
vector<long long int>b;
int main()
{
    long long int i,a,c,lob,hor,rem;
    while(scanf("%lld%lld",&lob,&hor)==2)
    {
        rem=1;
        a=lob/hor;
        printf("[%lld;",a);
        for(;;)
        {
            a=lob/hor;
            b.push_back(a);
            rem=lob%hor;
            lob=hor;
            hor=rem;
            if(rem==0)
            {
                break;
            }
        }
        c=b.size();
        for(i=1;i<c;i++)
        {
            printf("%lld",b[i]);
            if(i!=c-1)
            {
                printf(",");
            }
        }
        printf("]\n");
        b.clear();
    }
    return 0;
}

0 comments: (+add yours?)