10203 - Snow Clearing
Moderator: Board moderators
[/quote]Hi,
Turjo . Thanks . At last i got Acc after 10 WA's . If any one need any help plz mail me.
Regards
Rony(rony15bg@yahoo.com).
[[*Depressed*]]
Re: 10203
My Accepted code outputs same answer as you.WR wrote:What's wrong with the following results?
And - if nothings's wrong, why do I get WA?
I've tried int, long and double as co-ordinate types (in C).
I read all coordinates as double type number, and sum all distances as double type.
After calculate total distance, convert to long type number.
Then,
Code: Select all
long total;
double hour, minute;
...
...
...
total = (long)(calc_distances()); /* convert to long */
total *= 2;
hour = (double)(total / 20000);
total -= 20000 * hour;
minute = (double)total / (double)20000 * 60;
if((int)ceil(minute)==60) {
minute = 0;
hour += 1;
}
printf("%d:", (int)hour);
if(minute<10) printf("0");
printf("%d\n", (int)ceil(minute));
Best regards.
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 01, 2006 12:59 pm
- Location: (Fci-cu) Egypt
- Contact:
Please i need a help...
I am sure that i got the right distance but does this output is right
I am sure the problem in converting total seconds to nearest minute
I am sure that i got the right distance but does this output is right
Code: Select all
long double sec = (2*dist*60)/20000.0;
sec = ceil(sec);
long long minutes = sec / 60;
long long seconds = sec - minutes*60;
cout<<minutes<<":";
if(seconds<9)
cout<<"0";
cout<<seconds;
if(cases != 0)
cout<<"\n\n";
Sleep enough after death, it is the time to work.
Mostafa Saad
Mostafa Saad