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

还是WA阿。。。。。。。。

Posted by waterine at 2003-07-22 23:53:07 on Problem 1183
In Reply To:Re:1183算法请教 Posted by:00130004 at 2003-07-22 14:59:44
> 算法没错,注意范围。
> 60000^2+1=3600000001>2^31。
> 

#include <iostream.h>   
#include <math.h> 
void main(){ 
    int a; 
    __int64 temp,b,c; 
     
    cin >> a; 
    temp=a*a+1; 
    for(__int64 i=a; i>0; i--){ 
        if(temp%i == 0) {b=i; 
        c=temp/i; 
        break;} 
    } 
    cout <<int(a*2+b+c) << endl; 
} 

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