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 1210. Kind Spirits

Something wrong on test 5. Please help
Posted by AntSerTin 8 Feb 2005 02:38
#include "iostream.h"

void main ()
{
    long n,lay,from,fee;
    long i=0;
    long j;

    long arr[35];
    long arr2[35];
    long* one;
    long* two;
    long* help;
    char c;

    for (i=0;i<35;i++)
    {
        arr2[i]=0;
        arr[i]=0;
    };
    one=arr;
    two=arr2;

    cin>>n;

    for (i=0;i<n;i++)
    {
        cin>>lay;
        for (j=0;j<lay;j++)
        {
            cin>>from;
            if (from==0)
                    { continue;}
            cin>>fee;
            two[j+1]=one[from]+fee;
            while(2>1)
            {
                cin>>from;
                if (from==0)
                    { break;}
                cin>>fee;
                if (two[j+1]>(one[from]+fee))
                {
                    two[j+1]=one[from]+fee;
                };
            };
        };

        if (i!=n-1)
        {
            help=one;
            one=two;
            two=help;
            cin>>c;
        };
    };

    long m;

    m=two[1];
    for (j=1;j<lay;j++)
        if (m>two[j+1])
            m=two[j+1];
    cout<<m;

};
Re: Something wrong on test 3. Please help
Posted by xurshid_n 8 Feb 2005 12:50
I solved problem 1002 , i.e Phone numbers, but wrong on test 3 . Please help me.
Re: Something wrong on test 3. Please help
Posted by xurshid_n 8 Feb 2005 12:52
xurshid_n wrote 8 February 2005 12:50
I solved problem 1002 , i.e Phone numbers, but wrong on test 3 . Please help me.