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

FT 这就过 这么水?

Posted by just_one at 2011-03-24 14:16:53 on Problem 1455 and last updated at 2011-03-24 14:17:09
import java.util.Scanner;

public class Main
{
	public static int cal(int a)
	{
		int temp=a/2;
		return (temp)*(temp-1);
	}
	public static int cal_(int a)
	{
		int temp=a/2;
		int temp_=a-temp;
		return (temp)*(temp-1)/2+(temp_)*(temp_-1)/2;
	}
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		for(int i=0;i<n;i++)
		{
			int a=sc.nextInt();
			if(a%2==0)
			{
				System.out.println(cal(a));
			}
			else
			{
				System.out.println(cal_(a));
			
			}
		}
	}
}

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