Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么用float能过,double就超时

Posted by ck89119 at 2010-07-28 14:40:39 on Problem 1450
ans用float用时只有90ms,double却超时,想不通。。。

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
    int m,n,t;
    int i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d%d",&m,&n);
        float ans=m*n;
        if (m*n%2)
        {
             ans=ans-1+sqrt(2.0);
        }
        printf("Scenario #%d:\n",i+1);
        printf("%.2f\n\n",ans);             
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator