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 1292. Mars Space Stations

A Question
Posted by lasercat 8 Jul 2014 16:13
I get WA 1 with calculating distance in this way
for(int i=0;i<len;i++)
            {
                ans+=pow(((int)(buf[i]-'0')),3);
            }
while accepted in this way
 for(int i=0;i<len;i++)
            {
                ans+=(buf[i]-'0')*(buf[i]-'0')*(buf[i]-'0');
            }
WHY?!!!!
Is this a bug on judge or bug in function?!!
the compiler is g++
Re: A Question
Posted by Ade 24 Jan 2023 09:55
why not try this

ans+=round(pow(((int)(buf[i]-'0')),3));