Java练习 SDUT-1588_圆的面积
圆的面积
Time Limit: 1000 ms Memory Limit: 32768 KiB
Problem Description
Give you the radius of a circle,caculate its area,PI=3.141592653。
Input
The first line of the input is a positive integer N,then follows N lines,each line is a real number represent the radius of the circle.
Output
Output contains N lines,for each line of the input you should output one line, Case K: S,and K(count from 1)represents the number of the circle and S is the area.Keep two digits after the decimal point.
Sample Input
3
1
2
3
Sample Output
Case 1: 3.14
Case 2: 12.57
Case 3: 28.27
注意圆周率的值。
import java.util.*;
public class Main
{
static public void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int t,n;
node a = new node();
t = 0;
n = cin.nextInt();
while(++t<=n)
{
a.a = cin.nextDouble();
System.out.printf("Case %d: ",t);
System.out.printf("%.2f\n",a.GetSize());
}
cin.close();
}
}
class node
{
public double PI = 3.141592653;
double a;
double GetSize()
{
return a*a*PI;
}
}
Java练习 SDUT-1588_圆的面积的更多相关文章
- JAVA求圆的面积
import java.text.DecimalFormat;import java.util.Scanner; public class TheAreaOfCircle { public stati ...
- java代码。。。圆的面积好搞人。。。不是一般的搞人。。。欢迎指点指点
package com.ll; public class Class3 { private String name; private int age; private int ...
- java定义一个Circle类,包含一个double型的radius属性代表圆的半径,一个findArea()方法返回圆的面积
需求如下:(1)定义一个Circle类,包含一个double型的radius属性代表圆的半径,一个findArea()方法返回圆的面积. (2)定义一个类PassObject,在类中定义一个方法pri ...
- ACM_圆的面积
圆的面积 Time Limit: 2000/1000ms (Java/Others) Problem Description: AB是圆O的一条直径,CD.EF是两条垂直于AB的弦,并且以CD为直径的 ...
- hdu5858 Hard problem(求两圆相交面积)
题目传送门 Hard problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Other ...
- hdu 3264 Open-air shopping malls(圆相交面积+二分)
Open-air shopping malls Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- c语言求平面上2个坐标点的直线距离、求俩坐标直线距离作为半径的圆的面积、递归、菲波那次数列、explode
#include <stdio.h> #include <math.h> #include <string.h> char explode( char * str ...
- 【BZOJ】2178: 圆的面积并
http://www.lydsy.com/JudgeOnline/problem.php?id=2178 题意:给出n<=1000个圆,求这些圆的面积并 #include <cstdio& ...
- 【BZOJ】【2178】圆的面积并
自适应辛普森积分 Orz Hzwer 辛普森真是个强大的东西……很多东西都能积= = 这题的正解看上去很鬼畜,至少我这种不会计算几何的渣渣是写不出来……(对圆的交点求图包,ans=凸包的面积+一堆弓形 ...
随机推荐
- 【python之路32】python异常处理
一.捕获异常 1.try except #!usr/bin/env python # -*- coding:utf-8 -*- num = input("请输入一个数字:") t ...
- BZOJ 4554: [Tjoi2016&Heoi2016]游戏
Time Limit: 20 Sec Memory Limit: 128 MB Submit: 951 Solved: 572 [Submit][Status][Discuss] Descriptio ...
- Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误
使用Vue-cli3.x开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chu ...
- .NET框架之---MEF托管可扩展框架
MEF简介: 今天学习了下MEF框架,MEF,全称Managed Extensibility Framework(托管可扩展框架).MEF是专门致力于解决扩展性问题的框架,MSDN中对MEF有这样一段 ...
- Docker Mysql部署
1.下载tomcat镜像 docker pull mysql 2.启动容器 docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD ...
- idea展开和折叠方法的快捷键
Ctrl+"+/-",当前方法展开.折叠 Ctrl+Shift+"+/-",全部展开.折叠
- 创建多个Django业务模块
manage.py startapp cmdb 如果运行错误记得加环境变量 c:\python35\python.exe manage.py startapp cmdb
- leetcode 1-20 easy
1.Two Sum Given an array of integers, return indices of the two numbers such that they add up to a s ...
- 数据库Mysql监控及优化
在做 性能测试的时候数据最重要,数据来源于哪里呢,当然是数据库了,数据库中,我们可以知道,数据从磁盘中要比从缓存中读取数据的时间要慢的多的多,还可以知道,同样的一个sql语句,执行的效率也不一样,这是 ...
- PCL配置即常见问题
1 下载 把与VS版本对应PCL的AllInOne包下载下来.要下对安装包,需要了解安装包的命名的含义,以下面的一个AllInOne包的名字为例. PCL-1.8.0-AllInOne-msvc ...